Physical Clock Synchronization — Clock Series

In my last article, we discussed the various types of physical clocks. We discussed the accuracy offered by those clocks, and how UTC time is derived from TAI & UTI. We also discussed the concept of Leap Second, which is applied to UTC to accommodate for irregularities and the long-term slowdown in the Earth’s rotation.

NTP — Network Time Protocol

Before going into how leap seconds are applied, let’s talk about NTP!

NTP is an internet protocol used to synchronize with computer clock time sources in a network. NTP leverages UDP protocol over port 123, to synchronize clocks within a few seconds of the UTC time.

Each computer(OS) comes with the NTP Package. The NTP package contains a background program (daemon or service) which synchronizes the computer’s system time to one or more external reference time sources. Common daemons are ntpd and chronyd. You can refer to this to understand the difference between them.

But, where can your computer get the UTC time from?

NTP is structured as a hierarchy of servers. Each level in the hierarchy is called a stratum & it represents the distance from the reference clock. Stratums can range from 0–15(16 levels), with 0 being the reference clock. Each clock at stratum X synchronizes itself from stratum X-1.(the previous level). Any clock at stratum 16 is considered unsynchronized.

Reference Clock — Reference clocks are extremely accurate clocks like atomic clocks and GPS clocks. Reference clocks have a Stratum of 0.

Primary Time Servers — Primary Time Servers are directly connected to the Reference Clocks and sync their time with the Reference Clocks. They have a Stratum of 1. They are a few microseconds behind Stratum 0 clocks.

Stratum 2 Clocks — Stratum 2 clocks are connected to Stratum 1 clocks over the network. They are a few milliseconds behind Stratum 0 clocks.

Stratum 3 and beyond — Stratum X clocks are connected to Stratum X-1 clocks over the network. The latency from the Stratum 0 clocks keeps increasing as the levels keep increasing.

Each NTP server in a stratum can also reference other NTP servers in the same stratum to confirm the “true” time. Each server can perform the following roles —

As client it queries the reference time from one or more servers.

Pratik Pandey -

Senior Engineer with experience in designing and architecting large scale distributed systems.