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
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs