All notes
Ntp

# Intro

## Timestamps

Wikipedia. The 64-bit timestamps used by NTP consist of a 32-bit part for seconds and a 32-bit part for fractional second, giving a time scale that rolls over every $2^{32}$ seconds (136 years) and a theoretical resolution of $2^{-32}$ seconds (233 picoseconds). NTP uses an epoch of January 1, 1900 so the first roll over will be in 2036.

Future versions of NTP may extend the time representation to 128 bits: 64 bits for the second and 64 bits for the fractional-second.

## Clock synchronisation

server		t1 t2
client	t0			t3
time goes forward ->


Round-trip delay $\delta=(t3-t0)-(t2-t1)$, the offset $\theta=\frac{(t1-t0)-(t3-t2)}{2}$.

• The calculated $\delta$ and $\theta$ are passed through filters and subjected to statistical analysis. Outliers are discarded.
• The clock frequency is then adjusted to reduce the offset gradually, creating a feedback loop.
• The synchronization is correct when both the incoming and outgoing routes between the client and the server have symmetrical nominal delay. If the routes do not have a common nominal delay, there will be a systematic bias of half the difference between the forward and backward travel times.