I ran your code. The reason is because in 1970 daylight savings did not work the way it does now. I edited you code and added a %c to the format string + more space in the output string:
This is what I get with Mountain/Denver TZ on Solaris:
Secs: 3599 Time: Wed Dec 31 17:59:59 1969 17:59:59
Secs: 3600 Time: Wed Dec 31 18:00:00 1969 18:00:00
Secs: 3601 Time: Wed Dec 31 18:00:01 1969 18:00:01
FYI: DST does not work in winter in London, and most countries including North America had odd ball timezone settings way back then, if they even had it. I could go on. Your long variables "secs" should also be a time_t. Try starting with:
ok here is a perl date question not asked befor.
i know i am feeling small for not knowing. BUT!!!!
$ENV{TZ}="US/Central";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
how can i do the addition to year so i can get the current year w/o going $ntime=$year+1900;... (3 Replies)
I have this command in my script and it's working fine with AIX:
ls init?*.ora 2>/dev/null | egrep -i -e ""
the same command is failing in Solaris 10.
does anyone have better idea how to make it work for both ?
Thanks (1 Reply)
Strange behaviour of the strftime() function from gawk (3.1.5):
$ awk 'BEGIN{print strftime("%T", 3600)}'
> 02:00:00
$ awk 'BEGIN{print strftime("%T", 0)}'
> 01:00:00
Obviously something with DST but I can not figure out why? To me 3600 epoch seconds remains 01:00, DST or not.
From... (2 Replies)
Hello All,
I am facing a warning "Argument "" isn't numeric in localtime at"
what i m using is below
my $timestamp = Timestamp(time);
go_log("###############$timestamp###############");
can some one please suggest the way to avoid this message :confused: (6 Replies)
Hi Experts,
I know how to handle normal date changes in perl. Most of my requirement are full filled with following:
$date1 = strftime "%Y%m%d",localtime;
$date2 = strftime "%Y%m%d",localtime(time -24 * 60 * 60);
$date3 = strftime "%Y%m%d",localtime(time +24 * 60 * 60);
$date4 = strftime... (4 Replies)
HI,
i wish to convert a millsec value to a readable string format.
the one option is to use strftime.
However this is a bit costly (1-5 micros).
is there a a faster way to do so with just string manipulation
(Note i have the date object which has the time details but wish o avoid strftime) (2 Replies)
Hi,
I'm new to perl scripting and am trying it out.
I have a file written in the following format:
myfile-MMDDYY where MM is the number of the Month; DD the Day and YY the last two of the year... (Apologies for dumbing this down; I'm trying to be clear).
There is a new file put onto my... (2 Replies)
Hi all,
a=$1 ##
b=`echo "86400 * $a"|bc`
`perl -e 'use POSIX qw(strftime);$now_string = strftime "%d/%m/%Y", localtime(time-$b); print $now_string,"\n";' > date_file`
but im always getting current date; can any one suggest me any the improvement
the above works fine if i use some thing... (2 Replies)