Hacker News new | ask | show | jobs
by zokier 943 days ago
The time(2) manpage also states

       POSIX.1 defines "seconds since the Epoch" using a formula that
       approximates the number of seconds between a specified time and
       the Epoch. [...] This value is not the same as the actual number of
       seconds between the time and the Epoch, because of leap seconds
       and because system clocks are not required to be synchronized to
       a standard reference [...] see POSIX.1-2008
       Rationale A.4.15 for further rationale
https://man7.org/linux/man-pages/man2/time.2.html#VERSIONS

The word approximates is carrying a lot of weight here. So basically "seconds since the epoch" is a posix codephrase which doesn't actually mean what you'd naively think it does. Why this useful info is buried in the VERSIONS section instead of the main DESCRIPTION I don't know.

For Wikipedia, there is already discussion about the confusing wording of the opening paragraph: https://en.wikipedia.org/wiki/Talk:Unix_time#Flat_out_wrong? but the body of the article is mostly better, and especially the table showing what happens during leap second should clarify matters.