State Variables and Formats
NTP timestamps are represented as a 64-bit fixed-point number, in seconds relative to 0000 UT on 1 January 1900. The integer part is in the first 32 bits and the fraction part in the last 32 bits, as shown in the following diagram.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Integer Part |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Fraction Part |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This format allows convenient multiple-precision arithmetic and conversion to Time Protocol representation (seconds), but does complicate the conversion to ICMP Timestamp message representation (milliseconds). The low-order fraction bit increments at about 0.2-nanosecond intervals, so a free-running one-millisecond clock will be in error only a small fraction of one part per million, or less than a second per year.
In some cases a particular timestamp may not be available, such as when the protocol first starts up. In these cases the 64-bit field is set to zero, indicating the value is invalid or undefined.
Following is a description of the various data items used in the protocol. Details of packet formats are presented in the Appendices.
Leap Indicator
This is a two-bit code warning of an impending leap-second to be inserted in the internationally coordinated Standard Time broadcasts. A leap-second is occasionally added or subtracted from Standard Time, which is based on atomic clocks, to maintain agreement with Earth rotation. When necessary, the corrections are notified in advance and executed at the end of the last day of the month in which notified, usually June or December. When a correction is executed the first minute of the following day will have either 59 or 61 seconds.
Status
This is a six-bit code indicating the status of the local clock. Values are assigned to indicate whether it is operating correctly or in one of several error states.
Reference Clock Type
This is an eight-bit code identifying the type of reference clock used to set the local clock. Values are assigned for primary clocks (locally synchronized to Standard Time), secondary clocks (remotely synchronized via various network protocols) and even eyeball-and-wristwatch.
Precision
This is a 16-bit signed integer indicating the precision of the local clock, in seconds to the nearest power of two. For instance, a 60-Hz line-frequency clock would be assigned the value -6, while a 1000-Hz crystal clock would be assigned the value -10.
Estimated Error
This is a 32-bit fixed-point number indicating the estimated error of the local clock at the time last set. The value is in seconds, with fraction point between bits 15 and 16, and is computed by the sender based on the reported error of the reference clock, the precision and drift rate of the local clock and the time the local clock was last set. For statistical purposes this quantity can be assumed equal to the estimated or computed standard deviation, as described in [12].
Estimated Drift Rate
This is a 32-bit signed fixed-point number indicating the estimated drift rate of the local clock. The value is dimensionless, with fraction point to the left of the high-order bit. While for most purposes this value can be estimated based on the hardware characteristics, it is possible to compute it quite accurately, as described in [12].
Reference Clock Identifier
This is a 32-bit code identifying the particular reference clock. The interpretation of its value depends on value of Reference Clock Type. In the case of a primary clock locally synchronized to Standard Time (type 1), the value is an ASCII string identifying the clock. In the case of a secondary clock remotely synchronized to an Internet host via NTP (type 2), the value is the 32-bit Internet address of that host. In other cases the value is undefined.
Reference Timestamp
This is a 64-bit timestamp established by the server or client host as the timestamp (presumably obtained from a reference clock) most recently used to update the local clock. If the local clock has never been synchronized, the value is zero.
Originate Timestamp
This is a 64-bit timestamp established by the client host and specifying the local time at which the request departed for the service host. It will always have a nonzero value.
Receive Timestamp
This is a 64-bit timestamp established by the server host and specifying the local time at which the request arrived from the client host. If no request has ever arrived from the client the value is zero.
Transmit Timestamp
This is a 64-bit timestamp established by the server host and specifying the local time at which the reply departed for the client host. If no request has ever arrived from the client the value is zero.