![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| gawk and gensub | ripat | Shell Programming and Scripting | 2 | 05-10-2008 12:20 PM |
| awk,gawk in bat file | andrej | Shell Programming and Scripting | 0 | 05-09-2008 05:45 AM |
| strftime for JavaScript 1.2 (Default branch) | iBot | Software Releases - RSS News | 0 | 04-28-2008 01:40 AM |
| gawk HELP | sandeep_hi | Shell Programming and Scripting | 6 | 06-19-2006 05:56 AM |
| rs and ors in gawk ...???? | moxxx68 | Shell Programming and Scripting | 2 | 10-05-2004 09:52 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
gawk and strftime()
Strange behaviour of the strftime() function from gawk (3.1.5):
Code:
$ awk 'BEGIN{print strftime("%T", 3600)}'
> 02:00:00
$ awk 'BEGIN{print strftime("%T", 0)}'
> 01:00:00
From the gawk man pages: Code:
strftime([format [, timestamp]])
Formats timestamp according to the specification in format. The timestamp should be of the same form
as returned by systime(). If timestamp is missing, the current time of day is used. If format is
missing, a default format equivalent to the output of date(1) is used. See the specification for the
strftime() function in ANSI C for the format conversions that are guaranteed to be available. A pub‐
lic-domain version of strftime(3) and a man page for it come with gawk; if that version was used to
build gawk, then all of the conversions described in that man page are available to gawk.
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
DST is not UTC. If you mean METDST. It is one hour fast - exactly what you see. Plus you realize those values are for Dec 31 1969 - Jan 1 1970.
Midnight UTC is 1:00am DST. 1:00am UTC is 2:00am DST. What you see is correct. Most systems are supposed to support the TZ variable. Play around with that Code:
export TZ=MET-1METDST date export TZ=MET0 date export TZ=ZZZ-19 date |
|
#3
|
|||
|
|||
|
That was indeed the Time Zone that needed to be defined or canceled.
Code:
$ TZ=UTC awk 'BEGIN {print strftime("%T", 3600)}'
> 01:00:00
|
|||
| Google The UNIX and Linux Forums |