Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> If we think of a second as a tick of some amount of time, it makes sense to just count up once each tick.

It would, but Unix timestamps don't. It works exactly not how you assume.



Explain?

The article is claiming POSIX ignores injected leap seconds.


The article is needlessly unclear, but the specification given in the second blockquote is the one that is actually applied, and a simpler way of explaining it is: POSIX time() returns 86400 * [the number of UTC midnights since 1970-01-01T00:00:00] + [the number of seconds since the last UTC midnight].


POSIX doesn’t ignore leap seconds. Occasionally systems repeat a second, so time doesn’t drift beyond a second from when leap seconds were invented: https://en.wikipedia.org/wiki/Leap_second


After reading this article no less than 3 times, and the comments in this thread, I'm beyond lost.

So maybe the author was right. Because different people are claiming different things.


The Unix time article has concrete example with tables which should clarify the matter. https://en.wikipedia.org/wiki/Unix_time#Leap_seconds

In that example, Unix time goes from 915148799 -> 915148800 -> 915148800 -> 915148801. Note how the timestamp gets repeated during leap second.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: