Sponsored Content
Top Forums Shell Programming and Scripting Calculating the epoch time from standard time using awk and calculating the duration Post 302646327 by Scrutinizer on Friday 25th of May 2012 02:31:55 AM
Old 05-25-2012
Although this latter approach is not a conversion but an approximation and it will show (big) conversion errors around date changes..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

2. Shell Programming and Scripting

Calculating delay time - bash

Hi, I am having the following problem. test > hourOfDay=06 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime 180 test > hourOfDay=07 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime 120 test > hourOfDay=08 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime bash: (9-08: value... (5 Replies)
Discussion started by: jbsimon000
5 Replies

3. Shell Programming and Scripting

Calculating completion time

The date construct in UNIX can be used to calculate when something is finished: date -v+1H displays the time 1 hour from now. I want to use the same construct in a script, but it is leading to error messages: echo "Finished at: " `date -v+$durationH` where $duration is calculated based on input... (3 Replies)
Discussion started by: figaro
3 Replies

4. UNIX for Dummies Questions & Answers

Calculating the Hours between two time values

Dear Folks, I want to calculate the elapsed hours between two time columns. I am using timestampdiff method for the same. I am able to get the value. But facing an issue of decimal values. For example the elapsed hours between 09:00:00 and 20:30:00 is coming as 11 instead of 11.5. I am using below... (1 Reply)
Discussion started by: dinesh1985
1 Replies

5. UNIX for Advanced & Expert Users

Help with Calculating time difference between many directories in UNIX

A report needs to come some what similar to this No of elements Stream Batch No Load time A B C D A,B,C im able to get quite easily wc -l /usr/local/intranet/areas/prod/output/SRGW_0?/*/MESSAGE_T.dat O/P of above command. A B C ... (1 Reply)
Discussion started by: peckenson
1 Replies

6. Shell Programming and Scripting

calculating row-wise standard deviation using awk

Hi, I have a file containing 100,000 rows-by-120 columns and I need to compute for the standard deviation for each row. Any idea on how to calculate row-wise standard deviation using awk? My sample data looks like this: input data: 23 35 12 25 16 17 18 19 29 12 12 26 15 14 15 23 12 12... (2 Replies)
Discussion started by: ida1215
2 Replies

7. Shell Programming and Scripting

Calculating time windows from logfile timestamps

Hey all. I am working on some scripts in bash to perform a variety of functions; there are a variety of steps involved, and they must happen in a specific sequence; what I need help with is a way to calculate some differences in a timestamp in a logfile. One of the steps in the scripts I am... (3 Replies)
Discussion started by: danowar
3 Replies

8. Shell Programming and Scripting

Calculating script run time in Solaris OS

Hi All, I have written script and wanted to know the run time of it in seconds. i used below logic but am not getting the results in second instead getting error. cat pkloader.sh # if you want to calculate the time in milliseconds then use $(date +%s%N) START_TIME=`date +%s` echo... (2 Replies)
Discussion started by: Optimus81
2 Replies

9. Shell Programming and Scripting

Calculating the running time

Hi All, I want to run a utility for all the process id that are running for more than 15 mins. I have captured process id's and the time that they were run in a file like below 1st column represnts the process ids and the 2nd one is the Time < 21014 01:00 21099 01:00 24361 01:03 24406... (5 Replies)
Discussion started by: r_t_1601
5 Replies

10. Shell Programming and Scripting

Calculating Time difference Between two Rows in Linux

16:45:51 10051 77845 16:45:51 10051 77845 16:46:52 10051 77846 16:46:53 10051 77846 Match the last PID then subtract second line time with first line. Please help me with any command or script. working in media company on a project OS: RHEl7 tried command: awk 'function... (2 Replies)
Discussion started by: vivekn
2 Replies
TZSET(3)						   BSD Library Functions Manual 						  TZSET(3)

NAME
tzset, tzsetwall -- initialize time conversion information LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <time.h> void tzset(void); void tzsetwall(void); DESCRIPTION
The tzset() function initializes time conversion information used by the library routine localtime(3). The environment variable TZ specifies how this is done. If TZ does not appear in the environment, the best available approximation to local wall clock time, as specified by the tzfile(5)-format file /etc/localtime is used. If TZ appears in the environment but its value is a null string, Coordinated Universal Time (UTC) is used (without leap second correction). If TZ appears in the environment and its value begins with a colon (':'), the rest of its value is used as a pathname of a tzfile(5)-format file from which to read the time conversion information. If the first character of the pathname is a slash ('/') it is used as an absolute pathname; otherwise, it is used as a pathname relative to the system time conversion information directory. If its value does not begin with a colon, it is first used as the pathname of a file (as described above) from which to read the time conver- sion information. If that file cannot be read, the value is then interpreted as a direct specification (the format is described below) of the time conversion information. If the TZ environment variable does not specify a tzfile(5)-format file and cannot be interpreted as a direct specification, UTC is used. The tzsetwall() function sets things up so that localtime(3) returns the best available approximation of local wall clock time. SPECIFICATION FORMAT
When TZ is used directly as a specification of the time conversion information, it must have the following syntax (spaces inserted for clar- ity): std offset [dst [offset] [, rule]] Where: std and dst Three or more bytes that are the designation for the standard (std) or summer (dst) time zone. Only std is required; if dst is missing, then summer time does not apply in this locale. Upper and lowercase letters are explicitly allowed. Any characters except a leading colon (':'), digits, comma (','), minus ('-'), plus ('+'), and ASCII NUL are allowed. offset Indicates the value one must add to the local time to arrive at Coordinated Universal Time. The offset has the form: hh[:mm[:ss]] The minutes (mm) and seconds (ss) are optional. The hour (hh) is required and may be a single digit. The offset follow- ing std is required. If no offset follows dst, summer time is assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number. The hour must be between zero and 24, and the minutes (and seconds) -- if present -- between zero and 59. If preceded by a ('-') the time zone shall be east of the Prime Meridian; otherwise it shall be west (which may be indicated by an optional preceding ('+')). rule Indicates when to change to and back from summer time. The rule has the form: date/time,date/time where the first date describes when the change from standard to summer time occurs and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made. The format of date is one of the following: J n The Julian day n (1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29. n The zero-based Julian day (0 <= n <= 365 ) . Leap days are counted, and it is possible to refer to February 29. M m.n.d The d'th day (0 <= d <= 6) of week n of month m of the year (1 <= n <= 5), (1 <= m <= 12), where week 5 means ``the last d day in month m'' which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occurs. Day zero is Sunday. The time has the same format as offset except that no leading sign ('-') or ('+') is allowed. The default, if time is not given, is 02:00:00. If no rule is present in the TZ specification, the rules specified by the tzfile(5)-format file posixrules in the system time conversion information directory are used, with the standard and summer time offsets from UTC replaced by those spec- ified by the offset values in TZ. For compatibility with System V Release 3.1, a semicolon (';') may be used to separate the rule from the rest of the specification. FILES
/etc/localtime local time zone file /usr/share/zoneinfo time zone directory /usr/share/zoneinfo/posixrules rules for POSIX-style TZ's /usr/share/zoneinfo/Etc/GMT for UTC leap seconds If the file /usr/share/zoneinfo/UTC does not exist, UTC leap seconds are loaded from /usr/share/zoneinfo/posixrules. SEE ALSO
date(1), gettimeofday(2), ctime(3), getenv(3), time(3), tzfile(5) HISTORY
The tzset() and tzsetwall() functions first appeared in 4.4BSD. BSD
November 17, 1993 BSD
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy