Leap second
lastmod 2022-07-27created 2022-07-273 edits
A leap second is a one-second adjustment added to correct the error that arises from the difference between the cesium atomic clocks used as the basis of Coordinated Universal Time and solar time, which is based on the actual rotation and revolution speed of the Earth. It is added at the end of December 31 or at the end of June 30.
As of 2022, it has been applied 27 times since 1972,
The most recent leap second was applied at the transition from 23:59:59 on December 31, 2016 (UTC) to 00:00:00 on January 1, 2017 (UTC).
It's time to leave the leap second in the past
| WARNING |
| For now, read this as just one opinion |
- The leap second was introduced to correct the difference between UT1 (Universal Time) and UTC caused by the Earth's rotation speed
- It mainly benefits scientists and astronomers, because it allows UTC to be used for various purposes such as astronomical observation
- Without adjusting UTC, legacy equipment and software that synchronize with UTC for astronomical observation would have to be corrected
- Since the leap second was proposed, UTC has been adjusted a total of 27 times
- In 1972 the leap second was an acceptable solution that satisfied both the scientific and telecommunications communities, but today UTC is bad for both digital applications and scientists
- They often choose TAI (International Atomic Time) or UT1
Leap of Faith
- One of the many factors contributing to irregularities in the Earth's rotation is the continual melting and refreezing of the ice caps on the world's highest mountains
- This is easy to visualize if you think of a spinning figure skater
- So far there have only been positive leap seconds, so it was enough to simply insert an extra second, 23:59:60, between 23:59:59 and 00:00:00, but as the Earth's rotation pattern changes, a negative leap second is likely to occur at some point in the future. Then 00:00:00 would have to come right after 23:59:58.
- The effect of such a negative leap second has never been tested at scale, and it could have a catastrophic effect on software that relies on timers or schedulers
Smearing
- More recently, it has become common practice to gradually 'smear' the leap second by simply slowing down or speeding up the clock
- There is no universal way to do this, but at Meta the leap second is smeared over 17 hours starting at 00:00:00
- Since hundreds of NTP servers run together at Stratum 2, smearing too aggressively would cause NTP clients to judge them faulty and drop them from the quorum, which could lead to an outage
- Starting at 00:00:00 is not standardized either, so there can be various options
- For example, a particular company might start at 12:00:00 UTC and run for 24 hours
The negative impact of Leap Seconds
- Leap seconds and their offsets cause problems across the industry
- The easiest way to cause an outage is to write code assuming that time always moves forward
- Depending on how the spent above is used, it can become negative during a leap second
- In 2012 Reddit had a major outage because of a leap second, and the site was inaccessible for 30 to 40 minutes
- In 2017 Cloudflare published a detailed post about the impact on the company's public DNS
Moving beyond the leap second
- Leap second events cause problems across the industry and continue to carry significant risk
- In practice, we run into problems every time a leap second is introduced
- And because it is such a rare event, communities are devastated every time it happens
- As demand for clock precision grows across all industries, the leap second now does more harm than good and causes outages
- As engineers at Meta, we strongly support stopping the introduction of future leap seconds and keeping the current level of 27, which we believe will be enough for the next millennium
See also
Favorite site
Pages that link here