[tz] leapseconds.awk, LEAP directives and references

Chris Woodbury tzocd at yahoo.com
Tue Apr 4 16:02:43 UTC 2017

In the course of reviewing the AWK script leapseconds.awk,
I was disturbed by the fact that it (1) operated on the
comments (probably not a good idea) in the NIST produced
leap-seconds.list file rather than the NTP timestamp
itself and (2) that it assumed that leap seconds would
only occur in December and June.
The regulation that governs leap seconds, ITU-R TF.460-6
<https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>, actually
allows leap seconds to occur at the end of any UTC month.

    Annex 1, Section 2: Leap Seconds

    2.1  A positive or negative leap-second should be
    the last second of a UTC month, but first preference
    should be given to the end of December and June, and
    second preference to the end of March and September.

I note, in the event of a (highly unlikely) negative leap
second, the LEAP directive generated is for 23:59:59 which,
in the case of a negative leap second, doesn't exist.  I
reviewed the C code and, it seems to me, the transaction
added should actually be for the second before, 23:59:58,
as the transaction itself causes 23:59:59 to be skippedaltogether.  (Kinda hard to skip an event if you're in it.)

I bring this up as I've alrady written the changes necessary
but I want to verify the correctness of this last beforesubmitting them.

Also, I've an AWK script that uses the IERS file Leap_Seconds.dat
rather than the NIST leap-seconds.listfile.  Leap_Seconds.dat is
a straight list of leap-seconds.  USNO MAIA also has straight list
of leap-seconds in a different format.  See URLs:


Either of these would, particularly the IERS file as it has few but
excellent comments, be a better source of leap-second information
than the once removed NIST file leap-seconds.list; which is
purposed for another task.

Lastly, thanks to Dr. Eggert for including the reference I gave
him to the AAPT Resource Letter that included Terry Quinn's article
in the NIST Time and Frequency Division's PDF archive (1168). 

Anyone wanting to know about Time and Frequency Measurement might
want to read the other articles as well as Dr. Quinn's.

Another good, comprehensive article is "The leap second: its history
and possible future" by R.A. Nelson, et al, from Metrogia Vol 38,
pp. 509-529 (2001).  PDF available (with permission) at:


More information about the tz mailing list