Replies: 2 comments 14 replies
-
It will be accurate to whatever version of tzdb it has, whether that is the system's or one statically included. This will be no different than any change to time zones.
As has been stated before, no (at least without an explicit opt-in). The end goal of the time crate is to reflect reality. There shouldn't be any issues parsing leap smear, as they pretend there's still 10⁹ nanoseconds in a second (despite it being slightly more). Formatting, on the other hand, could result in a value that is invalid. My initial thought on supporting this would rely on a marker trait that serializers could implement (nb: the time crate would not do so) indicating that leap seconds should be formatted a different way (how doesn't much matter at this point). |
Beta Was this translation helpful? Give feedback.
-
A good blog post from engineers at Meta. |
Beta Was this translation helpful? Give feedback.
-
Proper handling of UTC leap seconds is a complex matter, which makes it a rich breeding ground for bugs and poorly conforming implementaitons. Furthermore, it makes calendar time computations themselves dependent on context data that changes in time.
At this point,
time
does not support leap seconds internally. The only concession is made in the RFC 3339 parser, where inputs with a second number 60 are allowed with the proviso of the referred moment being in a valid leap second (before #412 or a similar change is in, there are in fact no checks whatsoever, but this should be fixed). The parser approximates that to the last nanosecond of the preceding second 59 and calls it a success.Now, the discussion in #406 has made me wonder about future direction of this library. As it is planned to implement support for tzdb which is supposed to also provide leap second data, will time-rs be suitable for:
Beta Was this translation helpful? Give feedback.
All reactions