Subject: | minutes offset broken at leap second |
Date: | Tue, 27 Sep 2011 13:11:42 +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:05:00"); print $dt'
2009-01-01T23:59:60
$ 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:05:00"); print $dt'
2008-12-31T22:59:60
Only happens for a time in a leap second. With a +ve offset, the
minutes part of the offset is completely ignored. With a -ve offset,
any non-zero number of minutes in the offset has the effect of a 1
*hour* (negative) offset. Hours added onto this behave correctly.
Timezone offsets that are integral multiples of minutes have perfectly
well defined behaviour around leap seconds, when you're looking at
broken-down hh:mm:ss time-of-day.
-zefram