the djb way

updating leap seconds

The standard timestamp used in "the djb way" is TAI, for Temps Atomique Internationale. It is an absolute measure of elapsed time based on the decay of cesium atoms, where one day is equivalent to exactly 86,400 TAI seconds.

But the actual rotation of the Earth does not exactly conform to the TAI idea of time. In fact the Earth is slowing down a little bit, so that each physical day is minutely more than 86,400 TAI seconds.

Our human notion of time is based on this physical day length, and is represented by the UTC timeclock. The UTC timeclock is intended to represent a clock that points exactly 12:00 noon when the Sun is directly overhead on the solstice at 0 degrees longitude.

The ticks of the UTC timeclock are measured in TAI seconds. But because of the variance between the Earth's actual rotation and absolute TAI seconds, it is sometimes necessary to add a "leap second" to the UTC timeclock.

Many of djb's packages (including clockspeed, libtai, and mess822) install a file named /etc/leapsecs.dat. This file is a binary representation of the leapseconds added since 1972. It is used by djb software to translate UTC time to/from TAI. The last entry in this file is dated 1998-12-31.

djb's leapsecond data was valid for many years. However, as of midnight December 31, 2005, another leap second has been added to UTC. (Read the International Earth Rotation Service bulletin here.)

These are the instructions to update the leapseconds data on your system.

First, download the libtai package (

Unpack and compile the package as described for the djb "classic" build. Note that this package does not require any errno patch.

Edit the file named leapsecs.txt in the source code, inserting the new leapsecond adjustment at the end of the file. Then save the file as

(Here is my source file for the latest leapsecond: leapsecs.txt.2005-12-31.)

Finally, use the leapsecs utility to compile a new leapsecs.dat file with the new data:

$ leapsecs < >

The output is the binary data file named (And here is my data file compiled for the latest leapsecond: leapsecs.dat.2005-12-31.)

As root, copy the new data file into position:

# mv /etc/leapsecs.dat

The latest leap second adds one second to the year 2005. With the start of the year 2006, there are a total of 33 leap seconds in the UTC timeclock. Of these 33 leap seconds, 10 are intrinsic to UTC at the "epoch" -- that is, when the UTC timeclock came into being at 1972.01.01 00:00:00 UTC -- and 23 additional leapseconds have since been added.

Copyright © 2005, Wayne Marshall.
All rights reserved.

Last edit 2005.12.26, wcm.