#!perl -w use warnings; use strict; use Time::Local; my $time = time; print "Epoch time: $time\n"; print "ctime time: ",scalar(localtime($time)),"\n"; print " localtime: ",join(", ",localtime($time)),"\n"; print " timelocal: ",timelocal(localtime($time)),"\n";
Reports:
Epoch time: 1111461913 ctime time: Mon Mar 21 22:25:13 2005 localtime: 13, 25, 22, 21, 2, 105, 1, 79, 0 Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time +/Local.pm line 76. Use of uninitialized value in integer multiplication (*) at C:/Perl/li +b/Time/Loc al.pm line 76. Use of uninitialized value in integer multiplication (*) at C:/Perl/li +b/Time/Loc al.pm line 76. Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 6 +7. Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 6 +7. Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time +/Local.pm line 68. Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time +/Local.pm line 69. Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time +/Local.pm line 67. timelocal: 1111461913
Turning warnings off seems not to be an option; the module is spitting out the warnings under Test::More, which seems to always have warnings turned on.
Any ideas? Should I just put this in my release notes?
Update: Sorry for the slow response; I didn't get a chance to get back in front of a Windows machine last night.
Here is some more information:
As for the code in Time::Local, part of the problem is that $SecOff is somehow undefined, at least when I run it through the debugger. Here are a few lines:
# Line 24 immediately below my $SecOff = 0; # Line 66 immediately below sub _daygm { $_[3] + ($Cheat{pack("ss",@_[4,5])} ||= do { my $month = ($_[4] + 10) % 12; my $year = $_[5] + 1900 - $month/10; 365*$year + $year/4 - $year/100 + $year/400 + ($month*306 + 5)/10 +- $Epoc }); } # Line 75 immediately below sub _timegm { my $sec = $SecOff + $_[0] + 60 * $_[1] + 3600 * $_[2]; no integer; $sec + 86400 * &_daygm; }
In reply to Lots of errors from Time::Local on Windows by sgifford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |