Protocols for precise time transfer have been defined since the beginning of the Internet. The Datetime and Time protocols were ones of the first and therefore they both may be considered archaic today. The Time protocol is also known as rdate according to the famous client used in the past.
Following the Datetime protocol (port 13, RFC 867) server replies to the requests with ASCII string containing the actual time in a human readable format. The format is not more closely specified in the RFC.
Time protocol (port 37, RFC 868) defines the answer to the request as 32-bit number representing the actual time with number of seconds elapsed since 1st January 1900 UTC.
NTP (port 123) is the basic protocol used for time transfer and is also one of the oldest Internet protocols. The specification has been several times modified: NTP v1 (RFC 1059), NTP v2 (RFC 1119) with added authentication. NTP v3 (RFC 1305) contains revised algorithm and supports the calculation of minimum and maximum of expected error. In addition there is a simplified version SNTP (Simple NTP, RFC 2030) designated only for NTP clients.
Time is transfered with 64-bit fixed-point number. The first 32 bits indicates the number of seconds elapsed since 1st January 1900 UTC. The second 32-bit number holds the fractional part of the second. Thus the the time resolution equals to 230 ps. The counter of elapsed seconds overflows in 2036, two years before the 31-bit counter used in UNIX operating systems.
The basic algorithm of NTP remains the same regardless the long development of the NTP protocol:
δ = (T3 − T0) − (T2 − T1)
θ0 = [(T1 − T0) + (T2 − T3)] / 2
θ0 − δ/2 ≤ θ ≤ θ0 + δ/2
A client sends request with its actual time (time stamp) T0 included. The server receives the request in time T1 and sends response in time T2. The client receives the response in time T3. Note that the timestamps T0 and T3 refer to local clock of the client while the timestamps T1 and T2 relate to the server clock. Knowing all four timestamps the client calculates the roundtrip delay δ and the clock offset θ0. The calculation of θ0 presumes delay symmetry in both directions of the transfer. The real value of θ lays in the given interval.
Based on this the client achieves one sample that consists of three following values:
- offset - probable clock offset
- delay - roundtrip delay, offset uncertainty interval
- dispersion - stability of server clock (value sent by server in the response)
Such sample contains values affected by the immediate network state. Following algorithm specified in the RFC 1305 and implemented in the ntpd process is used to achieve higher precision and stability - the client sends periodically requests to multiple servers and the achieved samples are continuously processed using:
- removal of outliers
- filtration (from history of last 8 responses from each server)
- weighted averaging
- aggregation of data from particular servers
This leads to higher precision calculation of the client clock offset compared to the value achieved from a single sample. In addition the error minimum and maximum can be estimated.
There are two types of NTP clients with respect to the clock regulation:
- client with no regulation - local time scale is adjusted according to the determined clock offset. Frequency of the clock is not affected and long-term stability is not improved.
- client with regulation - clock offset serves as an input to the feedback loop controlling the clock frequency. Such regulation is software-implemented in a program or in the kernel.
Each NTP client with fully implemented protocol specification becomes a NTP server so that it is able to disseminate its time to other clients. The server is assigned with number from interval 1 - 15 known as Stratum. Stratum of a client is always higher than the Stratum of its server. This is how the hierarchy of NTP servers is formed. Stratum-1 denotes that the server is connected to the external source of precise time independent of other NTP servers. Such server is usually denoted primary NTP server. The Stratum doesn't express server precision but rather the distance to the external source of precise time.
The practical purpose of the hierarchy of NTP servers is in fact that primary servers are usually highly accurate but better service availability and resistance to interference such as network instability or failure of the external source of precise time is ensured by secondary servers. The typical recommended configuration is shown below.
S1 = Stratum-1 server
S2 = Stratum-2 server
Cl = Client
Several institutes operate NTP servers mainly for their own purposes or for their customers. Home site of the NTP project offers an extensive documentation on NTP including continuously updated list of public NTP primary (Stratum-1) time servers and public NTP secondary (Stratum-2) time servers. It would be necessary to follow the provider's terms and condition when periodically using listed servers.
There are many types of external clock suitable for primary NTP servers. From the physical point of view they can be split into two basic groups:
- Time signal receivers - GPS navigation system, Loran-C, WWV and well known DCF-77.
- Primary reference sources - atomic clocks (Cesium, Rubidium) or ultra-stable oscillators.
The best time accuracy may be achieved from the atomic clocks with long-term frequency stability from 10−13 to 10−15. The absolute error (difference to UTC) of a GPS receiver fits into interval of 1 ms to 50 ns whereas the error of a common DCF-77 receiver is typically 1 ms.
Precise time is usually delivered to the computer in the form of precise second pulses - 1 PPS signal (Pulse Per Second). The signal is fed to DCD pin of the serial port raising an interrupt. Corresponding interrupt routine assigns signal with timestamp. Concurrently the time information with resolution of 1 s (so called label) may be transfered using the serial link.
The precision of the primary NTP server's internal time scale depends on:
- precision of the 1 PPS signal
- the way the 1 PPS signal is processed (i.e. delay between pulse arrival and service in the interrupt routine)
- temperature stability of the oscillator used in the computer

