Posted by Richard N Williams on April 30th, 2012
When it comes to network time synchronisation, Network Time Protocol (NTP) is by far the most widely used software protocol. Whether it’s for keeping a network of hundreds or thousands of machines synchronised, or keeping a single machine running true, NTP offers the solution. Without NTP, and the NTP server, many of the tasks we perform on the internet, from shopping to online banking, simply wouldn’t be possible.
Synchronisation is vital for networks operating over the internet. Without synchronisation, there would be chaos. Imagine receiving an email from someone five minutes before it was sent or transferring money to a user whose machine says the money left before it arrived.
Coordinated Universal Time
To avoid all these problems, a single, universal timescale is employed across the internet, which is the same no matter what time zone a machine resides. Coordinated Universal Time (UTC) is governed by atomic clocks, so it is highly accurate and stable.
For computer networks to receive UTC, they use NTP servers, which receive the time source from either the GPS network (Global Positioning System), radio transmissions, or from the internet itself. Once received, it is up to NTP to take master time source and distribute it around a network to ensure synchronicity.
Network Time Protocol Explained
NTP is one of the oldest protocols in computing. It dates back to when the internet was still in its infancy, but it has been modified and adapted to ensure it is still relevant. In essence, NTP is an algorithm designed to adjudicate the timing on individual computers and compare them to the UTC time source. If NTP finds and discrepancies, it adjusts the clock on the offending device to ensure it matches. NTP does this with such accuracy that a network of a thousand machines can all be synchronised to within a few milliseconds of each other.
NTP adopts a hierarchical system. Rather than have every device on a network checked with the NTP server and its UTC time source, the protocol allows those machines closest to the server, to be used as reference to machines lower down. This avoids an influx of traffic to the NTP server and allows a single device to maintain synchronisation in a network of hundreds or even thousands of devices.
One of the biggest challenges NTP faces in using UTC as a time source is that this universal time is occasionally adjusted to maintain its correlation with the rotation of the Earth. Because the planet is ever so slightly slowing down, the atomic clocks that govern UTC are moiré accurate that the planet itself, so an occasional second is added once or twice a year to ensure there is no drift from day into night (although such a process would take millions of years).
These incremental changes are known as Leap seconds and are identified in the signals sent to most NTP servers. When NTP discovers a leap second is added, it automatically adjusts all devices on a network by repeating a second. Failure to adjust for these leap seconds would result in the network gradually drifting away from UTC and becoming out of sync with the rest of the internet community.