Subject: | epoch 2040 bug |
DateTime does not handle epoch dates larger than 2040, though it does
handle them properly when created as a normal object. For example, this
program:
use DateTime;
my $future = time() + 60*60*24*365*40; # roughly 40 years in the future
my $dt = DateTime->from_epoch(epoch=>$future);
print $dt->strftime('%Y-%m-%d')."\n";
my $dt = DateTime->new(year => 2046,
month => 10,
day => 16,
hour => 16,
minute => 12,
second => 47,
nanosecond => 500000000,
time_zone => 'Asia/Taipei'
);
print $dt->strftime('%Y-%m-%d')."\n";
Outputs these values:
1910-04-27
2046-10-16
However, both values should be somewhere in 2046.
What I don't know is if this is a bug in DateTime or a limitation in
Perl integers.
If it is a problem with Perl integers, is there a recommended strategy
for working around it?