On Sat, 5 Nov 2005, Mike Schilli wrote:
Adding seconds to a date gets stuck when it reaches a leap second:
use DateTime;
my $dt = DateTime->new(
year => 1972,
month => 12,
day => 31,
hour => 23,
minute => 59,
second => 55,
time_zone => "UTC");
for(1..10) {
$dt->add( seconds => 1);
print $dt->datetime(), "\n";
}
produces
1972-12-31T23:59:56
1972-12-31T23:59:57
1972-12-31T23:59:58
1972-12-31T23:59:59
1972-12-31T23:59:60
1972-12-31T23:59:60
1972-12-31T23:59:60
1972-12-31T23:59:60
1972-12-31T23:59:60
1972-12-31T23:59:60
That is indeed a bug. It'll be fixed in the next release, which assuming
I actually came up with a subtraction algorithm that makes sense, will be
soon.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/