from Hacker News

UTC, Tai, and Unix Time (2001)

by enz on 5/9/24, 8:40 AM with 141 comments

  • by billpg on 5/9/24, 2:08 PM

    Pick Two.

        A. A day is divided into a fixed number of smaller units.
        B. Each smaller time unit is of a fixed physical duration.
        C. The day cycle corresponds to the cycle of the solar day on Earth. 
    
    TAI picks A and B, allowing the solar cycle to drift from the time.

    UTC picks B and C, adding leap seconds to keep track with Earth's solar day cycle.

    UT1 picks A and C, redefining the "second" to the changing rate of earth's solar day cycle.

  • by justin_ on 5/9/24, 10:23 AM

    > UNIX time counts the number of seconds since an ``epoch.'' This is very convenient for programs that work with time intervals: the difference between two UNIX time values is a real-time difference measured in seconds, within the accuracy of the local clock. Thousands of programmers rely on this fact.

    Contrary to this, since at least 2008[0], the POSIX standard (which is just paper not necessarily how real systems worked at that time) has said that "every day shall be accounted for by exactly 86400 seconds." That means that in modern systems using NTP, your Unix timestamps will be off from the expected number of TAI seconds. And yes, it means that a Unix timestamp _can repeat_ on a leap second day.

    There's really no perfect way of doing things though. Should Unix time - an integer - represent the number of physical seconds since some epoch moment, or a packed encoding of a "date time" that can be quickly mapped to a calendar day? "The answer is obvious" say both sides simultaneously :^)

    EDIT: I know DJB is calling out POSIX's choices in this article, but it seems like his "definition" does diverge from what the count actually meant to a lot of people.

    [0] Also: "The relationship between the actual time of day and the current value for seconds since the Epoch is unspecified." https://pubs.opengroup.org/onlinepubs/9699919799.2008edition...

  • by re on 5/9/24, 10:00 AM

    Note that this page was written in 2001; the leap second situation has gotten a lot more complicated since then, with far more diverging implementations that handle it differently, and no real momentum towards widespread adoption of software that handles them "correctly" (explicitly), like the localtime() "fix" preferred by DJB.

    Most people seem to prefer ignoring leap seconds, pretending they don't exist by "smearing" them across the surrounding day, or even getting rid of them entirely. https://news.ycombinator.com/item?id=33658541 https://news.ycombinator.com/item?id=32226414

  • by aragilar on 5/9/24, 9:53 AM

    I'm surprised TAI isn't more widely used, given it hardcodes many of the assumptions programmers have about time.

    Sidenote, "Tai" in the title should be TAI.

  • by umanwizard on 5/9/24, 9:50 AM

    Leap seconds make no sense and we should just permanently stop doing them.

    It really doesn't matter if UTC drifts away from solar time by an hour every few thousand years.

  • by vbezhenar on 5/9/24, 3:19 PM

    TAI makes sense on Earth, but when it comes to separate cosmic bodies (like Moon base), my mind does not work well enough to understand how it would work, when time physically is different from the Earth time and even might change if we're talking about accelerating rockets. And how one would design a software and protocols exchanging instant values between those bodies.
  • by leandrod on 5/9/24, 4:40 PM

    Quite offensive its characterisation of Posix, given RMS’ involvement to make GNU viable, as far as memory serves me.
  • by prmoustache on 5/9/24, 11:08 AM

    Ultimately, I think nobody cares anymore about POSIX.