[tz] New Yorker article on David Mills and NTP

Garrett Wollman wollman at csail.mit.edu
Thu Oct 6 22:45:32 UTC 2022


<<On Thu, 6 Oct 2022 15:35:01 -0700, Guy Harris via tz <tz at iana.org> said:

> On Oct 6, 2022, at 1:41 PM, Brooks Harris via tz <tz at iana.org> wrote:
>> I would add that Posix relies on the c standard,

> Which appears neither to mandate nor forbid leap seconds.

C (intentionally) does not make any requirements on the encoding of a
time_t, other than requiring that it be numeric.  tzcode contains lots
of complexity to deal with the numerous possible different
realizations allowed by the C standard.  C allows time_t to be a
double.  (I haven't looked at recent C standards so I don't know if C
allows time_t to be complex or decimal.)

The POSIX standard, on the other hand, requires that time_t be an
integral type, and gives a closed-form formula for how a UTC time is
to be converted to a time_t which explicitly requires every day to be
exactly 86,400 seconds long.  (POSIX does not include tzcode's
timegm() interface; applications are expected to copy the formula from
the standard.)  The practical upshot of this is that POSIX systems
that implement leap seconds must tick the same second twice for a
positive leap second, and must skip a tick if there is ever a negative
leap second -- either way, making interval calculations inaccurate if
performed in "seconds since the Epoch" rather than struct tm.  (Some
people model the POSIX behavior as "the Epoch" changing every time a
leap second is inserted or subtracted, which scarcely improves
matters.)

The POSIX requirement is annotated as an "extension" to the C
standard.

-GAWollman




More information about the tz mailing list