Leaving it to the Last Second

By on 19 Dec 2016

Category: Tech matters


Blog home

Thanks to the Moon, the Earth’s rate of rotation is slowing down. It’s a subtle interaction, and the modelling of planetary dynamics predicts that the Earth’s rotation should slow down by an average of 2.3 milliseconds per century. But this is not quite so uniform, as The Economist reported in December on work of analysing ancient records of solar eclipses:

“After crunching the numbers, the team found that the actual rate at which days have been lengthening over the past couple of millennia is 1.8 milliseconds per century, considerably slower than the 2.3 milliseconds predicted. The main reason for the difference, they reckon, is the lingering effect of the most recent ice age, during which the mass of ice at the planet’s poles was sufficient to deform its shape and thus alter its rate of spin. That is not, though, the only thing which is happening. The researchers also found small but cyclical patterns in the rate of change that repeat themselves over decades—as well as intriguing hints of longer cycles with time periods of thousands of years. Exactly what geophysical goings-on such cycles represent is one for the geologists to work out.”

So what?

Maybe we can start by looking at how we’ve defined time over history.

How we’ve defined time over history

The ancient Egyptians divided a day into 12 night hours and 12 daylight hours, adjusting the duration of each of these hours according to the season so that nights and days were always divided into exactly 12 hours.

The ancient Babylonians used a sexagesimal system, dividing time into successively finer units using a base of 60.

It appears that it was the Arabs at the time of the first millennium who melded the two systems together, giving us a day composed of 24 hours, but dividing each hour using the Babylonian system into 60 minutes and each minute into 60 seconds. Each hour, minute and second was of constant duration.

The imperceptible slowing of the earth’s rotation meant nothing at the time, so that we were happy to stretch out what we accepted as a second of time such that it was always 1/86,400 of a single rotation of the earth about its own axis (the sun is intended to be at the same position relative to the earth after each rotation, which is why this time base is termed “solar time”).

It’s only been in recent decades that we’ve turned our attention to timekeeping with an obsessive level of detail that rivals, and maybe even surpasses, trainspotting. And this simple sun-based time base has been unable to withstand the pressure of such intense horological scrutiny.

In 1955, we went down the route of a standard definition of a “second” as a fixed time interval so that a “second” always spanned the same time duration.

This statement about the constancy of a time standard just begs the noting of the changes to this assumption introduced by the theory of relativity, where both space and time are distorted in order to preserve the constancy of the speed of light, irrespective of observers’ reference frames. But for our purposes let’s stick to a Newtonian world and assume a single inertial frame of reference where time beats at a constant invariant rate.

This “standard second” was defined by the International Astronomical Union as 1⁄31,556,925.9747 of the “mean tropical year” of 1900. This definition was also adopted in 1956 by the International Committee for Weights and Measures and in 1960 by the General Conference on Weights and Measures, becoming a part of the International System of Units (SI).

This definition addressed the problem of the drift in the value of the mean solar year, as well as the slowing of the Earth’s angular momentum by specifying a particular year as the baseline for the definition. However, by the mid-1960’s even this definition was found to be inadequate for precise time measurements.

In 1967, the SI second was again redefined, this time in experimental terms as a repeatable measurement. The new definition of a second was 9,192,631,770 periods of the radiation emitted by a caesium-133 atom in the transition between the two hyperfine levels of its ground state. This time base is “atomic time” (TAI).

All this is fine, except that the subtle influence of the Earth’s rotational slowing means that over the years our stunningly accurate clocks will start to drift away from the solar time baseline. The folk who found this to be an unacceptable deviation needed to find a way to accommodate both a fixed length second and the slowing rotation of the Earth.

The chosen solution was to keep the atomic time base (TAI) in sync with the Earth’s rotational solar time (Universal Coordinated Time, or UTC) by adjusting UTC time in units of one second from time to time. This is normally done when UTC drifts away from TAI by more than 0.6 seconds, and the “correction” is to insert or remove one entire SI-standard leap second into UTC time.

The UTC standard allows such correctional ‘leap seconds’ to be applied at the end of any month, but since 1972 all of these leap seconds have been inserted either at the end of 30 June or 31 December, making the final minute of the month in UTC either one second longer or one second shorter when a leap second is applied.

The Earth Orientation Centre of the International Earth Rotation and Reference System Service (IERS) publishes announcements every six months, advising whether leap seconds are to occur or not in the forthcoming six months. Longer periods of advance notice are not possible because of the degree of uncertainty in predicting the precise value of the cumulative effect of fluctuations of the deviation of the Earth’s rotational period from the value of the mean solar day.

Between 1972 and 2012, some 25 leap seconds have been added to UTC. On average this implies that a leap second has been inserted around every 19 months. However, the spacing of these leap seconds is quite irregular: there were no leap seconds in the seven-year interval between 1 January 1999 and 31 December 2005, but there were nine leap seconds in the eight years between 1972 to 1979. Since 31 December 1998, there have been only four leap seconds, on 31 December 2005, 31 December 2008, 30 June 2012 and 30 June 2015, each of which have added one second to that final minute of the month, at the UTC time of day.

Leap second-wise, it’s now crunch time again.

On Saturday 31 December 2016, the last minute of 2016 in UTC time will be extended to 61 seconds long.

Now all this would be just arcane esoterica for most of us were it not for the fact that we’ve trained our computers to be horologically-obsessive, so now pretty much every connected computer runs some form of time alignment protocol, such as the Network Time Protocol (NTP), to keep its clock in relatively good alignment with UTC.

NTP does not replace a system’s internal time of day clock. Instead, it keeps the system’s clock aligned to what NTP believe is the precise time of day by making periodic small adjustments to the system’s clock. In this model, a leap second displaces the system’s clock by one second from the NTP time, and NTP will subsequently shift the local clock back into sync with NTP’s time by a sequence of clock adjustments. Alternatively, NTP can signal the leap second to the system clock directly and the system clock can make an immediate adjustment by winding the system’s clock backwards by one second (as is done in POSIX systems).

Google use a slightly different method. They use a 20 hour period before and after midnight UTC to stretch the direction of the signalled second to be 13.9μs slower that the SI second. This “smears” the leap second across 20 hours, and keeps individual changes within the realm of the existing clock corrections applied to the internal quartz oscillators.

Other approaches to this leap second are documented by Red Hat and Microsoft. An excellent analysis of what happened last time can be found in an article by Stephen Strowes, Preparing for the 2016 Leap Second.

The POSIX approach of winding the kernel clock backwards by one second to replay the last second of the minute appears to be the cause of many system crashes. Time-related code rarely assumes that the system time runs backwards, and can get horribly confused when it does.

Smearing the change across a longer time interval makes some sense but different systems may perform this operation at different speeds. The objective of NTP is to create an environment where a collection of systems are synchronized in time to a relatively high degree of accuracy. During the period of the leap second smearing, this assumption may not hold and the collection of systems may differ in their view of the current UTC time by up to one second. Code might react badly as the common time base drifts from milliseconds to an entire second.

Previous leap seconds have caused some quite impressive system crashes as a result of unfounded assumptions about the constancy of UTC time. And it seems that the problems are persistent, in that the leap second in June 2015 managed to generate a few visible crashes despite a widely-reported negative experience from a similar leap second event just three years earlier. From mid-2015 there were press reports of interruptions of around 40 minutes duration that occurred with Twitter, Instagram, Pinterest, Netflix, Amazon, and Apple’s music streaming series, Beats 1.

It would be nice to think that recent leap seconds have been a learning experience and that this time around the leap second at the end of 2016 will take place without a murmur from our computers.

It would be nice to think that operating systems, applications, and services will all quietly cope with this additional beat added to the regular pulsing of the heartbeat of time, whether it’s performed by slowing the local clock or repeating that last second. Nice, but overly naive.

It’s more likely to expect some services to once again experience a hiccup as the leap second occurs. Doubtless, not all folk will be paying attention over the New Year weekend and some outages will occur.

If you operate online services, you may want to check for yourself when midnight UTC rolls around, that your services are not quietly choking over this extra time bonus that has been stuffed literally into the last minute of 2016.

Rate this article

The views expressed by the authors of this blog are their own and do not necessarily reflect the views of APNIC. Please note a Code of Conduct applies to this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please answer the math question * Time limit is exhausted. Please reload CAPTCHA.