Calling all Time Lords
2015 is a wonderful year for anyone who has a special interest in time or simply experiences its passage. In March, we enjoyed this century's Pi Instant, when clocks on 3/14/15 touched that rare Pi moment at 9:26:53.58979323.... And later this year, the world's time authorities will decide whether to change the definition of a "day." But today (30 June 2015) is special because it includes a Leap Second. The fourth such event this century, today's Leap Second event is not quite as rare as Pi Instants, but unlike Pi Instant Days or meetings of the world's time authorities, it is unpredictable -- at least for those of us without a Tardis.
The time standard, known as Coordinated Universal Time (UTC), as measured by atomic clocks, differs slightly from mean solar time, or Universal Time (UT1), which is proportional to the rotation angle of the Earth on its axis. The difference between UTC and UT1 varies as the Earth's rotation changes due to planetary events like tidal forces and earthquakes (Figure below).
In Recommendation ITU-R TF.460-6, the Planetary Council (aka ITU-R World Radiocommunication Conference) has decreed that when UTC and UT1 would differ by more than 0.9 seconds, a leap second should be added (or substracted) from UTC. Implementing this recommendation falls to the Planetary Time Committee (aka International Earth Rotation And Reference Systems Service, or IERS). Earlier this year, the IERS issued an announcement, addressed "To authorities responsible for the measurement and distribution of time (i.e., Time Lords)" (ok, I added the italicized bit, but you know that's what they meant), indicating that a leap second would be added at the end of June 30 as follows:
2015 June 30, 23h 59m 59s
2015 June 30, 23h 59m 60s
2015 July 1, 0h 0m 0s
The last time the IERS added a leap second, things basically went haywire - largely because OS schedulers failed to stop scheduled processes or started processes prematurely, hanging systems around the world. This year, the industry is confident that there's nothing to worry about. Earlier this year, the US Department of Homeland Security's National Cybersecurity and Communications Integration Center (NCCIC) issued a best practices recommendation for dealing with the leap second. No mini-Y2K events this time, we're assured.... Right.
As an embedded developer, should you be worried nonetheless? Chances are, no. OSs rely on updates from NTP (Network Time Protocol); RTOSs in particular typically don't keep calendar time themselves and rely on a real-time clock/calendar (RTCC) IC. Although RTCC ICs have built-in support for leap years, they don't for leap seconds.
"Unlike leap years, which follow a well-defined and predictable pattern, leap seconds are only added when necessary and, therefore, are unpredictable," points out Chris Parris, a Principal Applications Engineer from Microchip’s Memory Products Division, which is responsible for Microchip's RTCC ICs. "Consequently, RTCC ICs would always require a manual update of the time whenever a leap second is inserted."
So if precise calendar time is important, you might need to reset your RTCC. If your design consults NTP and auto-corrects, you won't even need to worry about doing that. Even without an explicit correction, many embedded applications are likely to tolerate a difference between UTC and their internal RTC IC time. A sampling application that relies on delta time measurements between events isn't going to be particularly sensitive to shifts in time offsets. If you're aggregating timestamped data, though, the extra second of data at midnight could produce an unexpected peak.
The ITU-R WRC recognizes that "...the occasional insertion of leap seconds into UTC may create difficulties for systems and applications that depend on accurate timing....". Consequently, at its next meeting to be held in Geneva, Switzerland, from 2 to 27 November 2015, the ITU-R WRC will consider abandoning leap seconds. WRC-15 Agenda Item 1.14 calls for a vote on the issue, deciding in effect whether the definition of a "day" will change to depend solely on cesium atoms or continue to be tied to the earth's rotation.
Regardless of the vote, nothing will change immediately: If the group votes to change time, they'll likely provide several years for the plan to go into effect; if they vote to keep time as is, time won't stand still but it's definition will -- at least until the group's next meeting in 2019. Indeed, the Earth will continue to revolve -- and time will continue to be measured by it.