Are you sure? Please include the Perl version used to run your program. And
remember that you need Perl 5.12.0 or later to get
proper Y2038 support in code Perl functions…
Cheers,
-Jan
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Rothenmaier, Deane C.
Sent: Tuesday, January 03, 2012 11:29 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: FYI... Time::Local::timelocal breaks in 2038
Perl gurus,
The following code demonstrates a catastrophic failure in the timelocal
function of the Time::Local package on Jan. 19th, 2038:
use strict;
use warnings;
use Time::Local;
sub convert_date_to_epoch {
my $str_date = shift;
$str_date =~ /^(\d{4})(\d{2})(\d{2})$/;
return( timelocal( 0, 0, 0, $3, $2 - 1, $1 - 1900 ));
}
my $date = 20380118;
my $bignum = convert_date_to_epoch( $date );
print epoch number for $date = $bignum\n;
$date = 20380119;
$bignum = convert_date_to_epoch( $date );
print epoch number for $date = $bignum\n;
The result of the second subroutine call is:
Day too big - 24855 24854
Sec too small - 24855 74752
Cannot handle date (0, 0, 0, 19, 0, 2038) at bignum.pl line 11
Don’t think this will affect many of us coding now, but if somebody’s looking
more than 26 years into the future, well, they’re in a
pickle.
Deane Rothenmaier
Programmer/Analyst – IT-StdCfg
Walgreens Corp.
2 Overlook Point #N51022D
MS 6515
Lincolnshire, IL 60069
224-542-5150
Blessed are they who have nothing to say and who cannot be persuaded to say it.
– James Russell Lowell
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs