# How does NTP synchronisation work?

I am trying to get a basic understanding of the NTP Algorithm. I read the Time Exchange section here. I have a few questions regarding it. Server A and Server B are trying to synchronise their times.

• A sends a packet to B. In the packet it stamps it's own time stamp as `original timestamp`
• B receives the packet. Sends a packet to A with its time stamp known as `received time stamp`. B also adds one more time stamp called as `transmit time stamp`. How does B calculate this?
• A receives the packet. A will once more log its own receipt time to estimate the travelling time of the packet. The travelling time (delay) is estimated to be half of "the total delay minus remote processing time", assuming symmetrical delays.

There are 2 unknowns here - The time taken for the packet to travel and the offset between the two clocks. Isn't the information above insufficient to resolve both the unknowns?

• This question might receive better answers on the Server Fault Stack Exchange than on Network Engineering. serverfault.com Mar 1, 2021 at 19:48

The travelling time (delay) is estimated to be half of "the total delay minus remote processing time", assuming symmetrical delays.

The processing time is the difference between "receive" and "transmit" (from the server.) The client knows when it sent the request -- "originate" -- and when it received an answer. The difference between send and receive, minus the server processing delay, is the offset. Several such requests are made to get a better picture of the various delays, ie. jitter, or what NTP calls dispersion.

Yes, it's all a calculated guess. Routing changes, traffic patterns change, queuing, etc., etc. It you want a dead-reliable, accurate clock, use a GPS clock. (or drop \$\$\$\$\$ on an atomic clock of your own.)

• "The difference between send and receive, minus the server processing delay, is the offset." - So we are ignoring the travel time of the packet? Mar 1, 2021 at 6:19
• @Ashwin The difference between send and receive includes the travel time of the request and its reply.
– Zac67
Mar 1, 2021 at 7:32
• @Zac67 The difference includes travel time. Agreed. But difference is also considered the offset. How do you remove the travel time from the offset? Mar 1, 2021 at 10:01
• The offset's purpose is to compensate for travel time, so that all NTP servers together provide a stable base overall.
– Zac67
Mar 1, 2021 at 10:08
• @Zac67 isn't offset supposed to be the time difference between the two clocks? If two clocks are out of sync, then the value that you add or subtract to make them in sync is the offset right? or did I get that wrong? Mar 1, 2021 at 10:28