Subject: | silly seconds value at leap second |
Date: | Tue, 27 Sep 2011 13:05:30 +0100 |
To: | bug-DateTime [...] rt.cpan.org |
From: | Zefram <zefram [...] fysh.org> |
$ perl -MDateTime -lwe '$dt=DateTime->new(year=>2008,month=>12,day=>31,hour=>23,minute=>59,second=>60, time_zone=>"UTC"); $dt->set_time_zone("+00:00:59"); print $dt'
2009-01-01T23:59:119
Only happens for a time located within a leap second, when combined with
a timezone offset that is not an integral number of minutes. That's an
inherently problematic combination, but giving a reading of 119 seconds
into the minute is not an acceptable response. You could fudge it to
give the same (sane) response as the preceding or following second,
00:00:58 or 00:00:59, or you could throw an exception.
-zefram