Skip to content

Comment on Designing a REST API: Unix Time vs. ISO-8601 (2013)parent

Comments

Do leap seconds work differently in UTC or something?

Leap seconds exist in UTC, that's the entire thing.

A leap second getting inserted (which has always been the case so far, though it may eventually change) means a UTC day ends on 23:59:60, which as far as UTC is concerned is perfectly fine, nothing wrong with a minute having 61 seconds.

UNIX time though? UNIX time is (86400 * days since epoch) + seconds since midnight.

23:59:60 is 86400, so on the last second of day X you're at 86400 * X + 86400, and on the next second (the first of day X+1) you're at 86400 * (X+1) + 0.

Which is the same value. And thus one second repeats.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.