Hacker News new | ask | show | jobs
by tvb 1613 days ago
Only a positive leap second is “over in a second”. A negative leap second is essentially “over before it starts”. This asymmetry is an opportunity for code to implement UTC incorrectly.

Another issue is that a positive leap second cannot be represented using time_t-like representations. But at least every time_t value maps to a UTC time.

By contrast a negative leap second, should one occur, will cause a permanent illegal time_t value that has no existence in UTC. Checking for that illegal value in every piece of code that uses time_t values will not be fun.

1 comments

> By contrast a negative leap second, should one occur, will cause a permanent illegal time_t value that has no existence in UTC. Checking for that illegal value in every piece of code that uses time_t values will not be fun.

Positive leap seconds, when translated into a dumb format and back, can be off by a second and won't round trip properly.

Negative leap seconds, when translated out of a dumb format and back, can be off by a second and won't round trip properly.

Seems pretty close to me.