# New Ticket Created by  Zefram 
# Please include the string:  [perl #127005]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127005 >


Internally DateTime allows its seconds value to be any kind of numeric
value in the right range, but when producing Str output in ISO 8601
format it limits the displayed seconds value to integral microseconds.
It attempts to round accordingly, but it screws up by only rounding the
seconds value in isolation:

> DateTime.new(:year(2000), :second(59.9999999)).Str
2000-01-01T00:00:60.000000Z

It produces invalid output like this whenever rounding up in the last
microsecond of a minute.  (If there's a leap second, :second(60.9999999)
is rounded to ":61.000000".)  The rounding ought to instead wrap the
seconds value and be carried to the minutes value, and to the hours if
the minutes wrap, and so on.  Or from another point of view, one should
round the DateTime value, and then express the rounded DateTime exactly,
rather than round the expression.

-zefram

Reply via email to