11 Network Time Protocol (Ntp)
NTP achieves accuracy in the range of 1-50ms
How do we measure by how much 2 clocks differ?
Round Trip Delay
Round Trip Delay = (T4 - T1) - (T3 - T2)
Cannot do (T2 - T1) + (T4 - T3) because times are different on different machines
Clock Difference
θ = [(T2 - T1) + (T3 - T4)] / 2
Do several rounds to average out noise
Stratum
a stratum tells you how close a time source is to the original
Stratum 0: The “real” clocks — atomic clocks, GPS receivers, or radio clocks that keep true UTC time. They’re not networked but act as the ultimate source.
Stratum 1: Servers directly connected to a Stratum 0 clock. They distribute that time over the network.
Stratum 2: Servers that get their time from Stratum 1 servers.
Stratum 3: Servers that sync to Stratum 2, and so on.
When A contacts B, it will adjust its time only if its own stratum level is higher than that of B. After synchronization A’s stratum level will be one higher than that of B.