Zeus Odin wrote:

use Time::Local;

# localtime cannot handle year 1903, but timelocal can
print scalar timelocal(0,0,0, 31, 11, 2003), "\n";
print scalar timelocal(0,0,0, 31, 11, 1903), "\n";

print scalar localtime timelocal(0,0,0, 31, 11, 2003), "\n";
print scalar localtime timelocal(0,0,0, 31, 11, 1903), "\n";

Output:
1072846800
-1830643200
Wed Dec 31 00:00:00 2003
Use of uninitialized value in print at E:\Documents\Perl\scratch.pl line 11.

Well, the number of epoch seconds returned by timelocal() may be negative, while localtime() returns undef if a negative number is passed to it. Just as expected due to


    perldoc Time::local

and

    perldoc -f localtime

But you're asking "why?". Guess you need to ask the perl porters. ;-)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to