1. Why a Leap Second Breaks the Assumption That Time Only Moves Forward
A leap second is a rule where one second is added occasionally to correct the difference between time based on Earth’s rotation and time kept by atomic clocks. This happened 27 times between 1972 and the end of 2016. [7]
Humans do not mind "adding one second." But programs are different. Many computers handle time as a number of seconds since January 1, 1970, without counting leap seconds (known as UNIX time). The standard that defines this counting method, POSIX, counts a day as exactly 86,400 seconds. [5] Therefore, there is no unique number for the extra second during a leap second.
Because of this, systems adjust by setting the clock back one second or counting the same second twice to make things match up. This "clock going back" causes glitches. For example, imagine a program that calculates duration by subtracting the start time from the end time, like a stopwatch. If the clock goes back one second during the calculation, the answer becomes 1 second shorter than it should be. If the event was shorter than 1 second, the result becomes negative.
2. How a Leap Second Caused Problems at Cloudflare on New Year’s Day 2017
Cloudflare helps display and secure websites worldwide. Their program for finding addresses from names (DNS) measures how long it takes to get a reply from other computers (round-trip time) to choose the fastest one. [1]
Usually, this takes a few milliseconds. But on January 1, 2017, at 0:00 UTC (9:00 AM in Japan), the clock went back one second due to a leap second. Because it happened while measuring, the round-trip time became a negative number. [1]
The program averaged multiple measurements. One negative value has a small effect, but after several times, the average itself became negative. This value was passed to a function that creates random numbers for choosing servers. Since that function stops if it receives a negative number, the system stopped working.
Only customers using a specific type of DNS record called CNAME were affected. Cloudflare wrote that errors appeared in about 0.2% of DNS queries and less than 1% of all HTTP requests at the worst moment. Fixes for the most affected machines were distributed within 90 minutes, reaching all locations by 6:45 AM UTC. [1]
Cloudflare engineers summarized the cause as "the false assumption that time never goes back." They also noted that the Go language used for this program at the time did not have a monotonic clock (a clock that does not go back). [1]
3. How Linux Computers Had Timer Problems During the 2012 Leap Second
Another example happened in 2012. When the leap second was added at the end of June 30 (July 1, 0:00 UTC, 9:00 AM in Japan), computers using Linux had problems around the world.
The reservation system "Amadeus Altea," used by Australian airlines Qantas and Virgin Australia, stopped for about one hour. Staff had to check people in manually. Services like Mozilla, Reddit, LinkedIn, and Yelp were also reported to be affected by similar bugs. Amadeus explained the cause as a "bug in the Linux kernel" and said they took steps to avoid it within an hour. [2]
Kernel developer John Stultz explained the cause this way: During the leap second, the kernel set the clock (CLOCK_REALTIME) back by one second. However, the part that manages timers (hrtimer) missed the process to tell it that the clock had gone back one second. [3]
It is like a worker asked to "notify at exactly 9:00" continuing to look at the old clock before it was set back. As a result, timers set by time went off one second early. Programs waiting for less than one second returned immediately. They repeated this wait-and-return cycle, causing a sudden spike in processing load. The fix was to add this notification to the leap second handling. [3]
This document explains the spike in load caused by timers. It does not mean that all reported failures were caused by this single reason.
4. Two Ways to Avoid Leap Second Glitches: Monotonic Clocks and Smearing
The first method is to use a monotonic clock (a clock that does not go back). When measuring elapsed time, use a stopwatch-like clock instead of the wall clock. For example, Python’s time.monotonic() is described as a "clock that never goes back" and is not affected if the system clock is changed. [6] On the other hand, time.time() can return a value smaller than before if the clock is set back.
The second method is Google’s approach. Since 2008, instead of adding the leap second all at once, they spread it out over time, adding it little by little. The recommended period is 24 hours, from noon UTC to the next day’s noon. During this time, each second becomes about 11.6 microseconds (11.6 millionths of a second) longer. [4] The clock does not go back, and "60 seconds" never appears. Instead, the difference from UTC is up to about 0.5 seconds.
5. The October 2026 Resolution to Stop Adding Leap Seconds
In October 2026, at the 28th General Conference on Weights and Measures (CGPM) held in Versailles, France, a resolution was adopted to stop leap seconds. [7] From May 20, 2027, Coordinated Universal Time (UTC) will be continuous. The difference between time based on Earth’s rotation (UT1) and UTC is allowed to widen up to a maximum of 3,600 seconds (1 hour). [8]
The resolution mentions that the probability of needing a "negative" leap second (subtracting time) in the future is rapidly increasing. It cites an estimate of 30% by 2035. Negative leap seconds have never been done before and are considered high risk for important infrastructure. [8] As seen in the two examples in this article, even just going back one second causes glitches. The impact of skipping a full second has not yet been tested.
However, in fields like astronomy and geodesy, where the difference between celestial positions and time is needed, this widening difference will be managed separately. [7]
Safety Note: The danger of "deleting" a second, which has never been tried before, is one of the reasons for abolishing leap seconds.
6. How to Check Time Subtraction Yourself
Write down a start and end time on paper and subtract them. If the start is 10:00:05 and the end is 10:00:08, the answer is 3 seconds.
Next, pretend "the clock went back one second during this." If the end time becomes 10:00:07, the answer is 2 seconds. A stopwatch (a clock that starts counting from zero) does not care if the wall clock goes back.
If you can use Python, try reading and comparing the explanations for time.time() and time.monotonic() in the official documentation. Do not actually perform an experiment where you "set the clock back one second," as this affects other software.