Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Have one New Year, get the second free

2005

Did you know that 2005 is going to be a long year? It certainly seems so with us; the arrival of Sam in July has made it feel like we're getting value for money. But this year is 1 second longer than most other years, thanks to the introduction of a Leap Second. At midnight, New Year's Eve, the time will roll from 23:59:59 to 23:59:60 before going to 00:00:00. (A good tidbit of knowledge for a pub quiz if ever there was one.)

So what's the reason for all this? Well, a second is historically based on the rotation of the Earth, but this hasn't been a constant speed through eternity. So the SI Second (International Standard in French) is defined as a number of vibrations of an atom like Caesium, which give us atomic clocks, which have been a constant for a long time (though back in the picoseconds after the big bang, it's not so certain). Since the Earth is slowing down gradually, the time as calculated from atomic clocks has been drifting apart from 'Earth time'.

To fix this problem, a Leap Second is added occasionally to re-align Earth Time with Atomic Time, and is known as UTC (Universal Co-ordinated Time, from the French). Essentially, the difference between GMT and UTC is that the latter has leap seconds, whereas the former does not; but otherwise, they're the same.

Atomic clocks in GPS use GMT/Atomic time for their calculations, and as such are drifting apart (currently about 14 seconds adrift). However, that doesn't make for much difference, since the GPS receivers download updates to their almanack periodically to take into account of variations such as these, and most of them will show time in UTC instead of GMT.

Oh, and as for the leap second ... it's applied simultaneously around the world. So the second is only added at midnight in Zulu time (GMT+0:00); in America's East Coast, for example, the Leap Second will be added between 18:59:59->18:59:60->19:00:00. Time zones ahead of GMT (Alpha through Mike time) get the Leap Second added on the 1st January 2006. If you've got a computer synchronized with a time server such as NTP, then your computer will slowly apply the difference between the two to synchronise the clocks with UTC. (You should be able to see the offset via a ntpdate command jump from a near-zero value to a near-one value around this time, and then gradually reduce:

server:~ alex$ ntpdate -q
server 0.0.0.0, stratum 0, offset 0.000000, delay 0.00000
server 17.72.133.45, stratum 2, offset 0.026083, delay 0.07675
31 Dec 09:26:35 ntpdate[5262]: adjust time server 17.72.133.45 offset 0.026083 sec

Time may wait for no-one, but occasionally it does get realigned.

Update: here's what the time change actually looked like. The clocks weren't synchronised again until about quarter past midnight, presumably due to the upstream clocks being synchronised before the changes were propagated downwards:

31 Dec 23:59:23 ntpdate[5835]: adjust time server 17.254.0.26 offset 0.015158 sec
31 Dec 23:59:29 ntpdate[5838]: adjust time server 17.254.0.26 offset 0.014253 sec
31 Dec 23:59:34 ntpdate[5841]: adjust time server 17.254.0.26 offset 0.013922 sec
31 Dec 23:59:39 ntpdate[5844]: adjust time server 17.254.0.26 offset 0.014428 sec
31 Dec 23:59:44 ntpdate[5847]: adjust time server 17.254.0.26 offset 0.014730 sec
31 Dec 23:59:49 ntpdate[5850]: adjust time server 17.254.0.26 offset 0.015892 sec
31 Dec 23:59:54 ntpdate[5853]: adjust time server 17.254.0.26 offset 0.014728 sec
31 Dec 23:59:59 ntpdate[5856]: adjust time server 17.254.0.26 offset 0.014819 sec
 1 Jan 00:00:05 ntpdate[5859]: adjust time server 17.254.0.26 offset 0.015820 sec
 1 Jan 00:00:10 ntpdate[5862]: adjust time server 17.254.0.26 offset 0.015119 sec
 1 Jan 00:00:15 ntpdate[5868]: adjust time server 17.254.0.26 offset 0.015021 sec
 1 Jan 00:00:20 ntpdate[5871]: adjust time server 17.254.0.26 offset 0.015205 sec
 1 Jan 00:00:25 ntpdate[5874]: adjust time server 17.254.0.26 offset 0.014131 sec
 1 Jan 00:00:30 ntpdate[5877]: adjust time server 17.254.0.26 offset 0.015185 sec
 1 Jan 00:00:36 ntpdate[5881]: adjust time server 17.254.0.26 offset 0.000441 sec
 1 Jan 00:00:41 ntpdate[5884]: adjust time server 17.254.0.26 offset 0.015037 sec
 1 Jan 00:00:46 ntpdate[5887]: adjust time server 17.254.0.26 offset 0.014836 sec
 1 Jan 00:00:51 ntpdate[5890]: adjust time server 17.254.0.26 offset 0.014636 sec
 1 Jan 00:00:56 ntpdate[5896]: adjust time server 17.254.0.26 offset 0.014526 sec
 1 Jan 00:01:01 ntpdate[5899]: adjust time server 17.254.0.26 offset 0.015294 sec
     :
 1 Jan 00:14:56 ntpdate[6443]: adjust time server 17.254.0.28 offset 0.014585 sec
 1 Jan 00:15:01 ntpdate[6448]: adjust time server 17.254.0.28 offset 0.015468 sec
 1 Jan 00:15:06 ntpdate[6451]: adjust time server 17.254.0.28 offset 0.016105 sec
 1 Jan 00:15:11 ntpdate[6454]: adjust time server 17.254.0.28 offset 0.019800 sec
 1 Jan 00:15:16 ntpdate[6460]: adjust time server 17.254.0.28 offset -0.006572 sec
 1 Jan 00:15:21 ntpdate[6463]: adjust time server 17.254.0.28 offset 0.017047 sec
 1 Jan 00:15:27 ntpdate[6466]: adjust time server 17.254.0.28 offset -0.020491 sec
 1 Jan 00:15:32 ntpdate[6469]: adjust time server 17.254.0.28 offset -0.034393 sec
 1 Jan 00:15:37 ntpdate[6472]: adjust time server 17.254.0.28 offset -0.030595 sec
 1 Jan 00:15:42 ntpdate[6475]: adjust time server 17.254.0.28 offset -0.073235 sec
 1 Jan 00:15:47 ntpdate[6478]: adjust time server 17.254.0.28 offset -0.032903 sec
 1 Jan 00:15:52 ntpdate[6481]: adjust time server 17.254.0.28 offset -0.024777 sec
 1 Jan 00:15:57 ntpdate[6484]: adjust time server 17.254.0.28 offset -0.054148 sec
 1 Jan 00:16:03 ntpdate[6487]: adjust time server 17.254.0.28 offset 0.019513 sec
 1 Jan 00:16:08 ntpdate[6490]: adjust time server 17.254.0.28 offset -0.056538 sec
 1 Jan 00:16:13 ntpdate[6494]: adjust time server 17.254.0.28 offset 0.015619 sec
 1 Jan 00:16:18 ntpdate[6499]: adjust time server 17.254.0.28 offset -0.030826 sec
 1 Jan 00:16:23 ntpdate[6502]: adjust time server 17.254.0.28 offset -0.096090 sec
 1 Jan 00:16:28 ntpdate[6505]: adjust time server 17.254.0.28 offset 0.015177 sec

 1 Jan 00:16:34 ntpdate[6508]: adjust time server 17.254.0.28 offset 0.013109 sec
 1 Jan 00:16:39 ntpdate[6511]: adjust time server 17.254.0.28 offset 0.015271 sec
 1 Jan 00:16:44 ntpdate[6514]: adjust time server 17.254.0.28 offset 0.015569 sec
 1 Jan 00:16:49 ntpdate[6517]: adjust time server 17.254.0.28 offset 0.014956 sec
 1 Jan 00:16:54 ntpdate[6520]: adjust time server 17.254.0.28 offset 0.015286 sec
 1 Jan 00:16:59 ntpdate[6523]: adjust time server 17.254.0.28 offset 0.015514 sec
 1 Jan 00:17:05 ntpdate[6526]: adjust time server 17.254.0.28 offset 0.015360 sec