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

Why Google Smears

Massive systems have to trust that one piece of data was stored before another, and a clock that repeats a second or shows 61 seconds in a minute can break that trust. So Google invented its own approach, called a leap smear, which spreads the extra second over the entire day.

How The Smear Works

Every tick runs a tiny bit different from the last, and the clock gets a microsecond further along each time. At some points in the day the servers can be maybe even half a second out from reality.

Staying In Step

That gap does not matter as long as every machine inside Google is off by the same amount. Everything on the servers is built to be out of sync with the world together, and what they need to know is that one event happened before another. Continuity is worth more to them than accurate time.

Why can't systems just repeat a second?

Databases and logs often decide which event came first by comparing timestamps. If a clock repeats a second, a later event can carry an earlier time than the event before it. When Cloudflare's DNS service handled the leap second at the end of 2016, its code produced a negative time value that caused errors for some customers, according to the company's own postmortem. A smeared clock never repeats, so differences between timestamps stay positive.

Do other companies smear leap seconds too?

Amazon Web Services smears leap seconds in its time synchronization service, and Meta has described using a smear in its own fleet. Each company chooses its own length and shape for the smear, so two providers can disagree by a small fraction of a second during that period. Servers that follow a smear and servers that insert the second as a jolt are not meant to be mixed. The Network Time Protocol is the usual way machines learn which time to follow.

More from Computerphile

Science & SpaceSome minutes have 61 secondsNow and then a minute holds 61 seconds, because the Earth does not rotate at a constant speed and the clocks have to keep up.
Enjoyed it?