Network Time Protocol
In today's interconnected era, clock synchronization essentially keeps the world as we know it running. It is a hidden aspect of modern computing that doesn't get nearly as much credit as it deserves. Clock synchronization is required for just about everything from the finance industry to cryptography (including TLS) to function properly.
Background on canonical timekeeping
There are hundreds of clocks used for official timekeeping - most of these maintained by various governments or laboratories, and research institutes around the world. Generally, these clocks use cesium-133 to precisely measure the passage of time.
The cesium standard
Cesium-133 emits microwave radiation, and emits these microwaves at an incredibly reliable interval, making it the ideal candidate to measure canonical time.[1]
These wave oscillations can be counted and used to determine when one second stops and another one begins. Cesium's resonant frequency is so reliable that it has been the International System of Units (SI) definition of a second since 1967. This means, the definition of a second is no longer 1/86400 of an Earth rotation, but the time it takes for a cesium-133 atom to emit 9,192,631,770 microwave oscillations.[2]
Atomic clocks
Atomic clocks sound radioactive because in a sense, they are. Atomic clocks contain cesium-133 and count these oscillations. The method used to excite these cesium atoms varies from clock to clock, but a common method in the modern timekeeping era is a device known as a cesium fountain.[3] Since we know how many of these oscillations should be in a second, atomic clocks can measure with extreme accuracy down to fractions of a nanosecond.
TAI & UTC
International Atomic Time (TAI, French acronym) is a running average of several hundred atomic clocks constantly synchronizing with each other. Each clock contributing to TAI maintains two versions of time: its own calculated time, and what it believes to be actual value of TAI factoring for latency.[5] This localized copy of TAI is then reported as the time in Coordinated Universal Time (UTC, again French acronym) and is considered the canonical, most accurate time in the world.
Counterintuitively, TAI and UTC are not the same thing. UTC accounts for leap seconds which are added manually to adjust UTC for the miniscule decrease in rotational speed of the Earth.[5] As of writing in 2024 the last leap second added was in 2017. There have been only 27 leap seconds since they were introduced in 1972.
When leap seconds were first added to UTC, 10 seconds were added in a lump sum. This has given us a total deviation of 37 seconds from UTC to TAI (with UTC being 37 seconds behind TAI). This time conversion is done on the fly when atomic clocks report out the time as a measure of UTC.
Implementation of NTP
David L. Mills started working on what would become the Network Time Protocol (NTP) in 1977 before it was scaled across the technology world in 1985.[6]
Generalizing for simplicity, the protocol works by sending a data packet to a time server of what time the device clock is set to. The time server records the time it received the message, the time it has as canonically correct, and the time that the time server sends the message back. The original device compares the time it was waiting with the start and end times sent by the server to calculate round-trip latency. It then calibrates its own clock to the time sent by the server and offsets the time by the latency detected.[6]
Standard electronic clocks will naturally drift a bit. Depending on the level of precision needed, devices can sync with time servers commonly from once a day, to several times an hour.
Stratum levels
Stratum levels are used to determine how far a clock's source is away from a canonically accurate clock.[5] Not every device can have a mildly radioactive microwave counter built into it, so there needs to be some standardized way of synchronizing time with the devices that do. These are effectively degrees of separation from an atomic clock.
Stratum 0
At the very top of the stack are the atomic clocks themselves. Since there are zero degrees of separation between these clocks and atomic clocks (because these devices are atomic clocks) these are called stratum 0. These are the handful of clocks that the rest of the world sets their time to.
Stratum (n)
With 1+ degrees of separation, you get into additional stratum levels. If everyone tried to connect their device to a Stratum 0 clock, we would quickly overwhelm the computing resources of these clocks - so additional clocks are needed to scale out to the rest of the world.
The clocks that synchronize their clocks directly from the atomic clocks are called Stratum 1 clocks. These are typically maintained by governments and research institutes - sometimes the same organizations that maintain atomic clocks, sometimes they just have special permission to connect to the atomic clocks.
There are still only so many connections that can safely be made to atomic clocks, and it helps if end users can connect to a clock geographically close to them to minimize latency. For those reasons, most large technology companies and service providers will maintain their own clocks for their users that synchronize back with Stratum 1 clocks. These more localized clocks are Stratum 2, because they have 2 degrees of separation between them and the atomic clocks. The Stratum 2 level is where most publicly accessible time clocks are.
There are still clocks that can be branched off of Stratum 2 clocks for a third level of separation. This is most useful when there is some benefit to having a time synchronization clock on your local network. Generally, Stratum 3 clocks are as localized as technology reasonably needs to go for source time. Nearly all devices will connect to a Stratum 2 or 3 clock.
More resources
The obscure system that syncs all the world's clocks (Half as Interesting)
References
- National Institute of Standards and Technology, "NIST’s Cesium Fountain Atomic Clocks" , 2009.
- National Institute of Standards and Technology, "SI Redefinition: Second" , 2019.
- G. Hoth, A. Radnaev, P. Mitchell, J. Sherman, V. Gerginov, "NIST-F3, a cesium fountain frequency reference" Proceedings of the 54th Annual Precise Time and Time Interval Systems and Applications (PTTI) Meeting, pp. 183-188, 2023.
- Bureau International des Poids et Mesures, "BIPM Annual Report on Time Activities, volume 15" ISBN 978-92-822-2280-5, 2020.
- D.L. Mills, IEEE Transactions on Communications (volume 39, issue 10), pp. 1482-1493, 1991. doi:10.1109/26.103043
- D.L. Mills, "Algorithms for Synchronizing Network Clocks" DARPA Network working group, RFC 956, 1985.
Support me on Ko-Fi