[LEAPSECS] leapseconds, converting between GPS time (week, second) and UTC
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Jan 16 03:29:46 EST 2019
--------
In message <20190115123411.44a0cf07 at spidey.rellim.com>, "Gary E. Miller" writes
:
>> But the underlying time_t cannot represent leap seconds, can it?
>
>Yes, and no. time_t is just seconds since an epoch. Which epoch
>is not well defined. The epoch may well be anything. See "man difftime".
I was lucky enough to share breakfast with Dennis Richie at the USENIX
ATC in New Orleans in 1998, and we talked a lot about the history and
future of /dev and timekeeping.
Originally time_t, which wasn't called that yet, was only 16 bits,
and the epoch was whenever you booted the system and because the
machines lacked memory management hardware, "rollover was usually
not a problem".
>time_t dates to the first edition of "Unix Programmer's Manual, November
>3, 1971". No timezone or other basis is given for time_t. They just
>said "system time". The first leap second was in 1972! time_t never
>caught up.
>In 1973, just after the third edition, time_t was pegged to GMT.
>
>According to wikipedia, GMT is mean solar time, not UTC. The seconds
>are not the same length, and no leap seconds:
Wrong. At the time GMT was what people had always called UTC, and there
were no difference between them.
>Some long time after that the doc changed from GMT to UTC, but the code
>did not. time() returns a time_t which pretends to be UTC, but ignores
>leap seconds. From a current "man time":
And that was simply how AT&Ts telephone network decided to handle
leapseconds: There were far too many time keeping devices installed
throughout the network for anybody to contemplate implementing leap
seconds on them. Most of them didn't keep time that well anyway.
I have not yet been able to pinpoint the first UNIX computer which
had hardware good enough to tell if leap-seconds were mishandled,
my best candidate right now is the Cray Y/MP.
The first networking of UNIX computers were over serial lines inside
individual labs, and the applications couldn't care less about what
time it was anyway. Nobody even dreamed about using computers
as authoritative clock for a long time.
As far as anybody has been able to make out, the first precision
time synchronization over computer networks, where leap seconds
could even be relevant, is Dave Mills work on FuzzBall and NTP, in
the first half of the 1980-ies on NSFnet - and the FuzzBalls didn't
run UNIX and only moved packets.
Even in 1988 when the UNIX API was rubberstamped into POSIX by IEEE,
nobody but Dave Mills really cared about leap-seconds, and even he
didn't care much about it. See for instance his last paragraph of
RFC958 from 1985.
When leap seconds finally appear on the radar, a freak geophysical
happenstance means there are no leap seconds for the precise six
years where most stuff is connected the internet.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the LEAPSECS
mailing list