Technical information - NTP Data Packet
Structure of theNTP Data packet
Cryptosum | LI | VN | Mode | Strat | Poll | Prec |
LI = leap indicator
VN = version number Strat = Stratum (0-15) Poll = poll intervall Prec = Precision |
Root Delay | |||||||
Root Dispersion | |||||||
Reference Identifier | |||||||
Reference Timestamp Seconds (32), Fraction (32) |
|||||||
Originate Timestamp Seconds (32), Fraction (32) |
|||||||
Receive Timestamp Seconds (32), Fraction (32) |
|||||||
Transmit Timestamp Seconds (32), Fraction (32) |
|||||||
Ext. Field 1 Key Identifier (optional) | |||||||
Ext. Field 2 Message Digest (optional) | |||||||
Authenticator
(Optional) |
Key/Algorithm Identifier | ||||||
Message Hash (64 or 128) |
NTPv4 Extension Fields
|
|
NTP Timestamp
NTP timestamp format (64 bits) : | |
Seconds (32) | Fraction (32) |
Seconds and Fractions since 01.01.1900 |
- The client sends a NTP message to the time server, which analyses the packet, substitutes the IP adresses and a few other fields, and than sends the packet back.
Now you get 4 timestamps:
Client | Connection | Server |
Timestamp 1 | Timestamp 2 | |
Timestamp 4 | Timestamp 3 |
- The "Delay", the time that was needed to transfer the packet in the network, and
- the "Offset", the time difference of the two computer clocks.
These values are calculated as follows:
Offset = | (t2 - t1) + (t3 - t4) ----------------- 2 |
Delay = | (t4 - t1) - (t3 - t2) |
Here you can see that NTP averages the Delay because it assumes that the trip of the packet is the same in both directions, that means differences influence the Offset as an error.
In local networks the round-trip delay is only a small part of the offset and therefor the offset calculation is already precise.
In bigger networks the offsets and delays are filtered more often, to compensate the delay variations. The offset is calculated from the packet with the smallest delay out of the last eight packets.
Additionally an other value is calculated from the same packets:
The "Dispersion" value,
an averaged value of the offset deviation from the eight last data packets to the actual offset.
The offsets with a smaller delay are weighted more.