[sf-perl] localtime bug
S A
parallax99 at hotmail.com
Wed Apr 12 10:51:31 PDT 2006
Anyone else have trouble with localtime behaving funny? For some odd
reason Time::Local is an hour off when it interprets this particular set of
numbers
[samshey at amshey samshey]$ cat test
#!/usr/local/bin/perl -w
use strict;
use Time::Local;
#timelocal($secs, $mins, $hrs, $day, $month, $year)
my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40
my $time_end = timelocal(33, 00, 04, 02, 03, 06); # 4:00:33
print "localtimes:\n";
print "timelocal start: $time_start (= " . localtime($time_start) . ")\n";
print "timelocal end: $time_end (= " . localtime($time_end) . ")\n";
print "gm times:\n";
print "timelocal start: $time_start (= " . gmtime($time_start) . ")\n";
print "timelocal end: $time_end (= " . gmtime($time_end) . ")\n";
exit;
[samshey at amshey samshey]$ perl test
localtimes:
timelocal start: 1143979180 (= Sun Apr 2 04:59:40 2006)
timelocal end: 1143975633 (= Sun Apr 2 04:00:33 2006)
gm times:
timelocal start: 1143979180 (= Sun Apr 2 11:59:40 2006)
timelocal end: 1143975633 (= Sun Apr 2 11:00:33 2006)
[samshey at amshey samshey]$ perl -v
This is perl, v5.8.8 built for i686-linux-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[samshey at amshey samshey]$
So strange....
/S
-
Stefan Amshey
parallax99 at hotmail.com
More information about the SanFrancisco-pm
mailing list