I have a module that uses Time::Local's timelocal function. It runs fine under Unix, but on some versions of Windows it spits out tons of errors. It seems that even a simple test program spits out tons of errors on Windows XP:
#!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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.