VClock

How Internet Time Synchronisation (NTP) Works

Your devices quietly correct their clocks over the internet many times a day. This guide explains the Network Time Protocol in plain language, with the actual maths, and shows how to check that your own sync is working.

By the VClock editorial team · Published 21 November 2026 · 5 min read · How we write

Inside every computer and phone is a quartz oscillator that counts time. It is cheap and decent, but not perfect: depending on temperature and manufacturing tolerances, a typical computer clock might drift by a second or more per day if nothing corrects it. The Network Time Protocol (NTP) is what corrects it. Designed by David L. Mills at the University of Delaware and first specified in 1985, it is one of the oldest internet protocols still in everyday use. The current version, NTPv4, is described in RFC 5905 (2010).

The hierarchy: strata

NTP organises time sources into levels called strata:

  • Stratum 0 are reference clocks: atomic clocks, GPS receivers or radio time-signal receivers. They are not on the network themselves.
  • Stratum 1 servers are computers directly connected to a stratum 0 device. National laboratories and some universities and companies run them.
  • Stratum 2 servers synchronise over the network with stratum 1 servers, stratum 3 with stratum 2, and so on, up to stratum 15. Stratum 16 means "not synchronised".

Your laptop is typically at stratum 3 or 4. The stratum number describes distance from the reference, not quality; a well-connected stratum 2 server can be more accurate in practice than a badly connected stratum 1.

The four timestamps

The clever part of NTP is how it removes network delay from the measurement. A client and server exchange one request and one reply, and four timestamps are recorded:

  1. t1: the client's clock when it sends the request.
  2. t2: the server's clock when the request arrives.
  3. t3: the server's clock when it sends the reply.
  4. t4: the client's clock when the reply arrives.

From these, the client calculates two numbers:

round-trip delay  δ = (t4 − t1) − (t3 − t2)
clock offset      θ = ((t2 − t1) + (t3 − t4)) / 2

The delay is the total time the packets spent on the network, excluding the time the server took to reply. The offset is the client's best estimate of how far its clock is from the server's.

A worked example

Suppose the client's clock is actually 0.500 seconds behind the server, and each direction of the network takes 0.020 seconds. The client sends at t1 = 10.000 (client time). The request arrives at the server at t2 = 10.520 (server time: 10.000 + 0.500 offset + 0.020 travel). The server replies immediately, t3 = 10.520. The reply arrives at t4 = 10.040 (client time: 10.000 + 0.020 + 0.020).

Delay δ = (10.040 − 10.000) − (10.520 − 10.520) = 0.040 s. Offset θ = ((10.520 − 10.000) + (10.520 − 10.040)) / 2 = (0.520 + 0.480) / 2 = 0.500 s. The client correctly concludes that it is half a second slow.

The calculation assumes the trip out and the trip back take the same time. If they do not (for example on a congested home connection where uploads are slower than downloads), the error is at most half the difference. That is the main reason internet time is accurate to milliseconds rather than microseconds.

Filtering and gentle correction

A full NTP implementation does not trust a single exchange. It polls several servers repeatedly, discards outliers, prefers samples with the smallest delay, and combines the survivors. It then corrects the clock gently:

  • Slewing. For small errors, the system speeds up or slows down the clock very slightly until it catches up. Time never jumps and never runs backwards, which matters to software that measures durations.
  • Stepping. For large errors (by default more than 128 milliseconds in the reference implementation), the clock is set directly, usually at startup.
  • Frequency discipline. Over time NTP learns how fast or slow your particular oscillator runs and compensates continuously, so it needs fewer corrections.

How accurate is it?

Over the public internet, a typical client stays within a few milliseconds to a few tens of milliseconds of UTC. On a well-designed local network with a nearby server, sub-millisecond accuracy is normal. Where much better accuracy is needed, for example in telecom networks, power-grid monitoring or financial trading systems, the Precision Time Protocol (PTP, IEEE 1588) with hardware time-stamping can reach sub-microsecond levels.

For human purposes, NTP is far more accurate than needed. A few milliseconds is less than the time it takes your screen to draw one frame.

Who provides the time

  • Operating system vendors. Windows uses time.windows.com by default, Apple devices use time.apple.com, and many Android phones use a Google time server or the time provided by the mobile network.
  • The NTP Pool Project. pool.ntp.org is a large volunteer cluster of servers worldwide and is the default for many Linux distributions and routers.
  • National laboratories. Many national metrology institutes offer public NTP servers traceable to their own realisation of UTC.

NTP uses UDP port 123. Corporate networks sometimes block it and provide an internal time server instead.

Simplified clients and leap-second smearing

Many small devices use SNTP, a simplified version of NTP that does one exchange and sets the clock. It is less accurate but adequate for most gadgets. Large online services have also adopted "leap smearing": instead of inserting an extra second at midnight when a leap second occurs, their servers stretch the seconds slightly over many hours so that clocks never show 23:59:60. That avoids software bugs but means smeared and non-smeared servers briefly disagree by up to half a second, so it is best not to mix them. Our guide on leap seconds explains why they cause trouble.

Check your own sync

  • Windows: Settings › Time & language › Date & time. Make sure "Set time automatically" is on and press "Sync now". In a terminal, w32tm /query /status shows the source and last sync.
  • macOS: System Settings › General › Date & Time › "Set time and date automatically".
  • Linux (systemd): timedatectl status should report "System clock synchronized: yes". With chrony, chronyc tracking shows the current offset.
  • Android and iPhone: enable automatic date and time in the system settings.

Then open the exact time page and compare it with another trusted source, such as a radio-controlled clock or a national laboratory's time website. If your device is more than a second or two out, see Why is my computer clock wrong?

Why web clocks depend on this

A web page cannot run NTP itself, because browsers do not let pages send raw UDP packets. Clocks like VClock therefore display the device clock, which NTP keeps correct. Some sites estimate your clock error by comparing your device time with their server's time over HTTP; that can detect large errors, but the measurement includes network delay, so it is less precise than NTP. Keeping your device's automatic time enabled is the single most effective thing you can do for accurate time in every app and website.

Related on VClock

Page last reviewed 21 November 2026 by the VClock team. Spotted an error? Tell us.