Korva is a scroll of the internet’s best ideas.

The 61 Second Minute

The planet slows down and speeds up as tectonic plates move and magnetic fields shift, or something like that. The International Astronomical Union works out whether a leap second is needed. When it is, the clocks go 23:59:58, then 23:59:59, then 23:59:60, and software that expects 60 seconds in a minute breaks.

What Computers Do

Depending on the implementation, a computer clock either ends up one second out of sync with the rest of the world or repeats a second.

Unix Time And Its Limits

The standard fix is the Unix timestamp, a number that started at the first exact second of 1970 and adds one second per second, tick after tick. Convert every date to that number, store it in a database, and leap seconds should take care of themselves. They do not, because Universal Coordinated Time includes leap seconds and occasionally repeats, while astronomical time leaves them out and has steadily drifted out of sync with the rest of the world. Astronomers need it that way because they look at the stars and design telescopes around it.

Why does the Earth's rotation speed vary?

Tidal friction from the Moon slowly lengthens the day, by roughly a couple of milliseconds per century. On top of that long trend, the planet's liquid core, the atmosphere, and the movement of ice and water change how fast it spins from year to year. Atomic clocks, which measure time by the vibration of atoms, have shown these wobbles since the 1950s. Between 1972 and 2016, 27 leap seconds were added to keep civil time in step with the Earth.

Why does Unix time ignore leap seconds?

The POSIX standard defines every day as exactly 86,400 seconds, so Unix time simply counts days and seconds without any extra entry for a leap second. When one occurs, systems either repeat a second or smear it to keep the count going. This keeps date arithmetic simple, since a day always has the same length. The cost is that Unix time drifts slightly from the true count of elapsed seconds.

Will leap seconds ever be abolished?

In 2022 the General Conference on Weights and Measures voted to stop using leap seconds by 2035. After that, the gap between atomic time and the Earth's rotation would be allowed to grow for a century or more before any correction. The decision came partly from the trouble leap seconds caused for computer systems. Astronomers who track the Earth's orientation will keep using their own measure.

More from Computerphile

Tech & AILibya changed time with days of noticeIn 2013, Libya decided with only a couple of days notice that it would not put its clocks back, and every Libyan computer ended up an hour out.
Enjoyed it?