# leap seconds [forwarded with permission from wollman at uvm-gen.emba.uvm.edu]

Paul Eggert eggert at twinsun.com
Mon Feb 7 21:49:18 UTC 1994

```   Date: Sun, 6 Feb 94 17:45:50 -0500
From: wollman at uvm-gen.EMBA.UVM.EDU

...According to the bulletins that I've seen, |TAI-UTC| is about
28 seconds now.  However, the leapseconds file only lists 19 steps.
This is probably due to the fact that the first step was 10 seconds,
not just 1.  Is there an easy way to fix this, so my users who use NTP
don't complain about their clocks being nine seconds off?

I'm not sure what you mean by ``fix''.  Let me try to review the
problem, perhaps repeating information that you already know.

Posix defines the time origin to be 1970-01-01 00:00:00 UTC.
But there's a problem with this definition: there is no such time,
because UTC didn't exist then!  UTC was not established until two
years later (1972-01-01 00:00:00).

UTC obeys two constraints: (1) |UTC-TAI| is an integer, (2) |UT1-UTC| < 0.9 s.
TAI is International Atomic Time, our best approximation to ``real'' time.
UT1 is astronomical time, our best approximation to Earth's rotation angle;
it was the basis for civil time between 1956 and 1972.

When UTC was established in 1972, UTC-TAI was set to be exactly 10 s.
This explains why UTC-TAI will be 29 s after 1994-06-30, even though
the leapseconds file lists only 19 seconds inserted by then.

Why was UTC-TAI initially 10 s and not zero?  Because UTC is designed
to track UT1 within 0.9 s, and UT1-TAI was approximately 10 s at the
time UTC was established.  And _this_ is because TAI was set
approximately equal to UT1 on 1958-01-01, and the two scales had
diverged by 10 s in 1970.

Had UTC existed on 1970-01-01 under the current rules, it would have
differed from TAI by either 7 or 8 s.  The ambiguity is because of the
slop in UTC's constraint (2).  In practice, this ambiguity is resolved
by a committee of the International Earth Rotation Service, but that
won't help us for times before 1972.

So, to get back to the original question, how should you fix this?
I see three possible fixes:

A.  Leave the leapseconds file alone, and pretend that civil
time equaled TAI + 10 s before 1972.  Add a 10 s correction to
the code that converts between the tz package's times and NTP.
This introduces an error of about 2 or 3 s for times around
1970.

B.  Invent some leap seconds for the period between 1970 and
1972, as if UTC had been in effect then.  This lies about UTC
but repairs the 2 or 3 s error.  The conversion correction
would be correspondingly reduced, to 7 or 8 s.

C.  Invent some leap seconds for the period between 1955-07-01
and 1972.  This is the same as (2) but reduces errors for old
times.  We can't go back before 1955-07-01 because atomic time
didn't exist before then.  A problem with (C) is that some
hosts don't allow negative time_t values.

(A) is easiest and in a sense is the most honest, but it has one major
problem: it leaves us 2 or 3 s away from our goal of having time_t
values that represent ``the number of seconds since 1970-01-01 00:00:00 GMT'',
the way Unix was originally intended.

```