Simple Network Time Protocol (SNTP)
A lightweight way to synchronize computer clocks over the network.
Mills, D., "Simple Network Time Protocol (SNTP)", RFC 1361, DOI 10.17487/RFC1361, August 1992, <https://www.rfc-editor.org/info/rfc1361>.
@misc{rfc1361,
series = {Request for Comments},
number = 1361,
howpublished = {RFC 1361},
publisher = {RFC Editor},
doi = {10.17487/RFC1361},
url = {https://www.rfc-editor.org/info/rfc1361},
author = {D. Mills},
title = {{Simple Network Time Protocol (SNTP)}},
pagetotal = 10,
year = 1992,
month = aug,
} RFC text
Contents
Network Working Group D. Mills
Request for Comments: 1361 University of Delaware
August 1992
Simple Network Time Protocol (SNTP)
Status of this Memo
This memo provides information for the Internet community. It does
not specify an Internet standard. Distribution of this memo is
unlimited.
Abstract
This memorandum describes the Simple Network Time Protocol (SNTP),
which is an adaptation of the Network Time Protocol (NTP) used to
synchronize computer clocks in the Internet. SNTP can be used when
the ultimate performance of the full NTP implementation described in
RFC-1305 is not needed or justified. It involves no change to the
current or previous NTP specification versions or known
implementations, but rather a clarification of certain design
features of NTP which allow operation in a simple, stateless RPC mode
with accuracy and reliability expectations similar to the UDP/TIME
protocol described in RFC-868.
This memorandum does not obsolete or update any RFC. A working
knowledge of RFC-1305 is not required for an implementation of SNTP.
1. Introduction
The Network Time Protocol (NTP) specified in RFC-1305 [MIL92] is used
to synchronize computer clocks in the global Internet. It provides
comprehensive mechanisms to access national time and frequency
dissemination services, organize the time-synchronization subnet and
adjust the local clock in each participating subnet peer. In most
places of the Internet of today, NTP provides accuracies of 1-50 ms,
depending on the jitter characteristics of the synchronization source
and network paths.
RFC-1305 specifies the NTP protocol machine in terms of events,
states, transition functions and actions and, in addition, optional
algorithms to improve the timekeeping quality and mitigate among
several, possibly faulty, synchronization sources. To achieve
accuracies in the low milliseconds over paths spanning major portions
of the Internet of today, these intricate algorithms, or their
functional equivalents, are necessary. However, in many cases
accuracies of this order are not required and something less, perhaps
in the order of one second, is sufficient. In such cases simpler
protocols such as the Time Protocol [POS83], have been used for this
purpose. These protocols usually involve a remote-procedure call
(RPC) exchange where the client requests the time of day and the
server returns it in seconds past some known reference epoch.
NTP is designed for use by clients and servers with a wide range of
capabilities and over a wide range of network delays and jitter
characteristics. Most members of the Internet NTP synchronization
subnet of today use software packages including the full suite of NTP
options and algorithms, which are relatively complex, real-time
applications. While the software has been ported to a wide variety of
hardware platforms ranging from supercomputers to personal computers,
its sheer size and complexity is not appropriate for many
applications. Accordingly, it is useful to explore alternative access
strategies using far simpler software appropriate for accuracy
expectations in the order of a second.
This memorandum describes the Simple Network Time Protocol (SNTP),
which is a simplified access strategy for servers and clients using
NTP as now specified and deployed in the Internet. There are no
changes to the protocol or implementations now running or likely to
be implemented in the near future. The access paradigm is identical
to the UDP/Time Protocol and, in fact, it should be easily possible
to adapt a UDP/Time client implementation, say for a personal
computer, to operate using SNTP. Moreover, SNTP is also designed to
operate in a dedicated server configuration including an integrated
radio clock. With careful design and control of the various latencies
in the system, which is practical in a dedicated design, it is
possible to deliver time accurate to the order of microseconds.
It is strongly recommended that SNTP be used only at the extremities
of the synchronization subnet. SNTP clients should operate only at
the leaves (highest stratum) of the subnet and in configurations
where no SNTP client is dependent on another SNTP client for
synchronization. SNTP servers should operate only at the root
(stratum 1) of the subnet and then only in configurations where no
other source of synchronization other than a reliable radio clock is
available. The full degree of reliability ordinarily expected of
primary servers is possible only using the redundant sources, diverse
subnet paths and crafted algorithms of a full NTP implementation.
This extends to the primary source of synchronization itself in the
form of multiple radio clocks and backup paths to other primary
servers should the radio clock fail or become faulty. Therefore, the
use of SNTP rather than NTP in primary servers should be carefully
considered.
2. NTP Timestamp Format
SNTP uses the standard NTP timestamp format described in RFC-1305 and
previous versions of that document. In conformance with standard
Internet practice, NTP data are specified as integer or fixed-point
quantities, with bits numbered in big-endian fashion from zero
starting at the left, or high-order, position. Unless specified
otherwise, all quantities are unsigned and may occupy the full field
width with an implied zero preceding bit zero.
Since NTP timestamps are cherished data and, in fact, represent the
main product of the protocol, a special timestamp format has been
established. NTP timestamps are represented as a 64-bit unsigned
fixed-point number, in seconds relative to 0h on 1 January 1900. The
integer part is in the first 32 bits and the fraction part in the
last 32 bits. 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 precision of this representation
is about 200 picoseconds, which should be adequate for even the most
exotic requirements.
Note that since some time in 1968 the most significant bit (bit 0 of
the integer part) has been set and that the 64-bit field will
overflow some time in 2036. Should NTP or SNTP be in use in 2036,
some external means will be necessary to qualify time relative to
1900 and time relative to 2036 (and other multiples of 136 years).
Timestamped data requiring such qualification will be so precious
that appropriate means should be readily available. There will exist
a 200-picosecond interval, henceforth ignored, every 136 years when
the 64-bit field will be zero, which by convention is interpreted as
an invalid timestamp.
3. NTP Message Format
Both NTP and SNTP are clients of the User Datagram Protocol (UDP)
[POS83], which itself is a client of the Internet Protocol (IP)
[DAR81]. The structure of the IP and UDP headers is described in the
relevant specification documents and will not be described further in
this memorandum. Following is a description of the SNTP message
format, which follows the IP and UDP headers. The SNTP message format
is identical to the NTP format described in RFC-1305, with the
exception that some of the data fields are "canned," that is,
initialized to prespecified values. The format of the NTP message
data area, which immediately follows the UDP header, is shown below.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|LI | VN |Mode | Stratum | Poll | Precision |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root Delay |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Root Dispersion |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reference Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Reference Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Originate Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Receive Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Transmit Timestamp (64) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| |
| Authenticator (optional) (96) |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
As described in the next section, in SNTP most of these fields are
initialized with prespecified data. For completeness, the function of
each field is briefly summarized below.
Leap Indicator (LI): This is a two-bit code warning of an impending
leap second to be inserted/deleted in the last minute of the current
day, with bit 0 and bit 1, respectively, coded as follows:
LI Value Meaning
-------------------------------------------------------
00 0 no warning
01 1 last minute has 61 seconds
10 2 last minute has 59 seconds)
11 3 alarm condition (clock not synchronized)
Version Number (VN): This is a three-bit integer indicating the NTP
version number, currently 3.
Mode: This is a three-bit integer indicating the mode, with values
defined as follows:
Mode Meaning
------------------------------------
0 reserved
1 symmetric active
2 symmetric passive
3 client
4 server
5 broadcast
6 reserved for NTP control message
7 reserved for private use
The use of this field will be discussed in the next section.
Stratum: This is a eight-bit integer indicating the stratum level of
the local clock, with values defined as follows:
Stratum Meaning
----------------------------------------------
0 unspecified or unavailable
1 primary reference (e.g., radio clock)
2-15 secondary reference (via NTP or SNTP)
16-255 reserved
Poll Interval: This is an eight-bit signed integer indicating the
maximum interval between successive messages, in seconds to the
nearest power of two. The values that normally appear in this field
range from 6 to 10, inclusive.
Precision: This is an eight-bit signed integer indicating the
precision of the local clock, in seconds to the nearest power of two.
The values that normally appear in this field range from -6 for
mains-frequency clocks to -18 for microsecond clocks found in some
workstations.
Root Delay: This is a 32-bit signed fixed-point number indicating the
total roundtrip delay to the primary reference source, in seconds
with fraction point between bits 15 and 16. Note that this variable
can take on both positive and negative values, depending on the
relative time and frequency errors. The values that normally appear
in this field range from negative values of a few milliseconds to
positive values of several hundred milliseconds.
Root Dispersion: This is a 32-bit unsigned fixed-point number
indicating the maximum error relative to the primary reference
source, in seconds with fraction point between bits 15 and 16. The
values that normally appear in this field range from zero to several
hundred milliseconds.
Reference Clock Identifier: This is a 32-bit code identifying the
particular reference clock. In the case of stratum 0 (unspecified) or
stratum 1 (primary reference), this is a four-octet, left-justified,
zero-padded ASCII string. While not enumerated as part of the NTP
specification, the following are representative ASCII identifiers:
Stratum Code Meaning
------------------------------------------------------------
0 ascii generic time service other than NTP, such as ACTS
(Automated Computer Time Service), TIME (UDP/Time
Protocol), TSP (TSP Unix time protocol), DTSS
(Digital Time Synchronization Service), etc.
1 ATOM calibrated atomic clock
1 VLF VLF radio (OMEGA, etc.)
1 callsign Generic radio
1 LORC LORAN-C radionavigation system
1 GOES Geostationary Operational Environmental Satellite
1 GPS Global Positioning Service
2 address secondary reference (four-octet Internet address of
the NTP server)
Reference Timestamp: This is the local time at which the local clock
was last set or corrected, in 64-bit timestamp format.
Originate Timestamp: This is the local time at which the request
departed the client for the server, in 64-bit timestamp format.
Receive Timestamp: This is the local time at which the request
arrived at the server, in 64-bit timestamp format.
Transmit Timestamp: This is the local time at which the reply
departed the server for the client, in 64-bit timestamp format.
Authenticator (optional): When the NTP authentication mechanism is
implemented, this contains the authenticator information defined in
Appendix C of RFC-1305. In SNTP this field is ignored for incoming
messages and is not generated for outgoing messages.
4. SNTP Client Operations
The model for an SNTP client operating with either an NTP or SNTP
server is a RPC client with no persistent state. The client
initializes the SNTP message header, sends the message to the server
and strips the time of day from the reply. For this purpose all of
the message-header fields shown above are set to zero, except the
first octet. In this octet the Leap Indicator is set to zero (no
warning) and the Mode to 3 (client). The Version Number must agree
with the software version of the NTP or SNTP server; however, NTP
Version 3 (RFC-1305) servers will also accept Version 2 (RFC-1119)
and Version 1 (RFC-1059) messages, while NTP Version 2 servers will
also accept NTP Version 1 messages. Version 0 (original NTP described
in RFC-959) messages are no longer supported. Since there are NTP
servers of all three versions operating in the Internet of today, it
is recommended that the Version Number field be set to one.
The server reply includes all the fields described above; however, in
SNTP only the Transmit Timestamp has explicit meaning. The integer
part of this field contains the server time of day in the same format
as the Time Protocol. While the fraction part of this field will
usually be valid, the accuracy achieved with the SNTP mode of access
probably does not justify its use.
The following table is a summary of the SNTP client operations. There
are three recommended error checks shown in the table. In all NTP
versions, if the Leap Indicator field is 3 or the Transmit Timestamp
is zero (unsynchronized), the server has never synchronized or not
synchronized to a valid timing source within the last 24 hours. If
the Stratum field is 0 (unspecified or unavailable), the server has
never synchronized, has lost reachability with all timing sources or
is synchronized by some protocol other than NTP. Whether to believe
the transmit timestamp or not in this case is at the discretion of
the client implementation.
Field Name Request Reply
-------------------------------------------------------------
Leap Indicator (LI) 0 if 3 (unsynchronized),
disregard
Version Number (VN) (see text) ignore
Mode 3 (client) ignore
Stratum 0 if 0 (unspecified),
disregard
Poll 0 ignore
Precision 0 ignore
Root Delay 0 ignore
Root Dispersion 0 ignore
Reference Identifier 0 ignore
Reference Timestamp 0 ignore
Originate Timestamp 0 ignore
Receive Timestamp 0 ignore
Transmit Timestamp 0 time of day (seconds only);
if 0 (unsynchronized),
disregard
Authenticator (not used) ignore
5. SNTP Server Operations
The model for an SNTP server operating with either an NTP or SNTP
client is an RPC server with no persistent state. The SNTP server
ignores all header fields except the first octet, modifies certain
fields and returns the message to the sender. Since an SNTP server
ordinarily does not implement the full set of NTP algorithms intended
to support the highest quality service, it is recommended that an
SNTP server be operated only in conjunction with a source of outside
synchronization, such as a radio clock. In this case the server
always operates at stratum 1.
The first octet is interpreted as follows. The Leap Indicator and
Version Number fields are ignored. Optionally, messages with version
numbers other than 1, 2, or 3 can be discarded. For primary servers
connected to a functioning radio clock, the Leap Indicator field is
set to zero and the Stratum field is set to one in the reply.
otherwise, these fields are set to 3 and zero, respectively. In any
case the Version Number and Poll fields are copied intact to the
reply message header. If The Mode field is set to 3 (client), it is
changed to 4 (server) in the reply; otherwise, this field is set to 2
(symmetric passive).
The Stratum field is set to reflect the maximum reading error of the
local clock. For all practical cases it is computed as the negative
of the number of significant bits to the right of the decimal point
in the NTP timestamp format. The Root Delay and Root Dispersion
fields are set to zero for a primary server; optionally, the Root
Dispersion can be set to a value corresponding to the expected
(constant) maximum expected error of the primary reference source.
The Reference Identifier is set to designate the primary reference
source, as indicated in the table above. If this information is
unspecified or unavailable, the field is set to zero.
The timestamp fields are set as follows. The Reference Timestamp,
Receive Timestamp and Transmit Timestamp fields are set to the time
of day at the server. The Originate Timestamp field is copied
unchanged from the request. The following table summarizes these
actions.
Field Name Request Reply
----------------------------------------------------------
Leap Indicator (LI) ignore 0 (normal), 3
(unsynchronized)
Version Number (VN) ignore copied from request
Mode (see text) (see text)
Stratum ignore server stratum (1)
Poll ignore copied from request
Precision ignore server precision
Root Delay ignore 0
Root Dispersion ignore 0 (see text)
Reference Identifier ignore source identifier or 0
Reference Timestamp ignore time of day or 0
Originate Timestamp ignore copied from request
Receive Timestamp ignore time of day or 0
Transmit Timestamp ignore time of day or 0
Authenticator ignore (not used)
6. References
[DAR81] Postel, J., "Internet Protocol - DARPA Internet Program
Protocol Specification", RFC 791, DARPA, September 1981.
[MIL92] Mills, D., "Network Time Protocol (Version 3) Specification,
Implementation and Analysis", RFC 1305, University of Delaware,
March 1992.
[POS80] Postel, J., "User Datagram Protocol", RFC 768,
USC/Information Sciences Institute, August 1980.
[POS83] Postel, J., and K. Harrenstien, "Time Protocol", RFC 868,
USC/Information Sciences Institute, SRI, May 1983.
Security Considerations
Security issues are not discussed in this memo.
Author's Address
David L. Mills
Electrical Engineering Department
University of Delaware
Newark, DE 19716
Phone: (302) 831-8247
EMail: mills@udel.edu
AI ELI5
On this page
§1Why Simpler Time Sync Matters
Full NTP, described in RFC 1305, uses complex algorithms to synchronize computer clocks across the Internet with high accuracy. It handles multiple possible synchronization sources, compensates for network jitter, and adjusts the clock rate to maintain long-term accuracy. This works well for servers, but full NTP is too heavy for many devices.
SNTP is an adaptation of NTP that drops the complexity when it is not needed. It works like a stateless remote-procedure call: the client asks the server for the time, the server replies, and the client extracts the answer. Accuracy is typically in the range of a second or a few milliseconds, depending on the network, which is sufficient for many applications. The RFC emphasizes that SNTP should be used only at the edges of the synchronization network—clients that only listen, and simple servers attached to a reliable time source such as a radio clock.
Think of NTP as a very careful teacher with lots of tricks to teach you the exact time. SNTP is a student asking the teacher once: "What time is it?" and trusting the answer.
§2The NTP Message Format
SNTP reuses the NTP message format exactly: a 48-byte header followed by optional authentication. The header contains eight fields in the first four octets and four 64-bit timestamp fields.
The first octet holds three fields: Leap Indicator (2 bits, warns of a leap second), Version Number (3 bits, currently 3), and Mode (3 bits, indicating client, server, or broadcast). Below that are Stratum (the level of the source: 1 for primary, 2+ for secondary), Poll Interval (how often to poll, in powers of two), and Precision (the clock precision, also in powers of two). The next two fields, Root Delay and Root Dispersion, give the round-trip delay to the primary source and the maximum error, both in fixed-point seconds. Reference Identifier names the reference clock.
The four timestamp fields occupy 64 bits each. Reference Timestamp is when the clock was last set. Originate Timestamp is when the client sent the request. Receive Timestamp is when the server received it. Transmit Timestamp is when the server sent the reply. In SNTP, only the Transmit Timestamp matters to the client; it contains the server's time of day.
The message is a form you fill out. The client writes its name and "client mode" at the top and leaves everything else blank. The server fills in the current time in one field and sends it back.
| Field | Name | Size | Value | Description |
|---|---|---|---|---|
LEAP-INDICATOR | Leap Indicator | 2 bits | Warning of leap second: 0 = no warning, 3 = unsynchronized. | |
VERSION-NUMBER | Version | 3 bits | NTP version (typically 1, 2, or 3). | |
MODE | Mode | 3 bits | 3 = client request, 4 = server reply. | |
STRATUM | Stratum | 1 byte | Clock level: 1 = primary, 2+ = secondary. | |
POLL | Poll Interval | 1 byte | Maximum time between polls (power of 2, in seconds). | |
PRECISION | Precision | 1 byte | Local clock precision (power of 2, in seconds). |
§3Client and Server Operation
An SNTP client is a stateless request-reply machine. It builds a message with all fields zeroed except the first octet, which has Leap Indicator set to zero, Version Number set (typically to 1 for compatibility), and Mode set to 3 (client). It sends this message to the server and waits for a reply. When the reply arrives, the client reads the Transmit Timestamp field, which contains the server's time in NTP format: a 64-bit number representing seconds and a fraction since midnight on 1 January 1900. The integer part is the seconds; the client can set its clock to that value or interpolate using the fraction for better accuracy.
The RFC recommends three error checks: if the Leap Indicator is 3 (alarm, meaning the server is not synchronized), if the Transmit Timestamp is zero (unsynchronized), or if the Stratum is 0, the client should disregard the reply. Otherwise, the time is usable.
An SNTP server is also stateless. It receives a message, ignores all fields except the first octet, and replies with a properly filled message. For a primary server connected to a radio clock, it sets Leap Indicator to 0 and Stratum to 1. It copies the Version Number and Poll fields from the request. It sets Mode to 4 (server) if the request was mode 3 (client), otherwise to 2 (symmetric passive). The Reference Timestamp, Receive Timestamp, and Transmit Timestamp are all set to the server's current time. The Originate Timestamp is copied unchanged from the request. The other fields are set to zero or to values reflecting the clock's precision and the radio clock's characteristics.
The client is like a student: it asks "What time is it?" and writes down the answer. The server is like a clock on the wall: whenever anyone asks, it says the current time.
§4How Time is Represented
NTP and SNTP timestamps use a special 64-bit format: the first 32 bits are the integer part (seconds) and the last 32 bits are the fractional part. The value represents the number of seconds since midnight on 1 January 1900, using a fixed-point representation. This format allows for convenient arithmetic and has a precision of about 200 picoseconds, more than adequate for any practical timekeeping application.
The RFC notes an important quirk: since 1968, the most significant bit of the integer part (the sign bit in some representations) has been set, indicating the time is after 1900. The 64-bit field will overflow some time in 2036. The RFC suggests that when this happens, external metadata will be needed to distinguish times relative to 1900 from times relative to 2036. By convention, an all-zero timestamp is treated as "invalid".
The timestamp is like writing the date as a big number. NTP writes it in a special way that makes math easy and lets it be very, very precise—down to less than a millionth of a millionth of a second.
§5When to Use SNTP
SNTP is intended for the edges of a time-synchronization network. SNTP clients are appropriate for devices that only receive time updates from servers, such as personal computers, workstations, or network appliances. SNTP servers should only be deployed at the root of the synchronization tree, directly connected to a reliable primary time source such as a radio clock. The RFC strongly cautions that the full redundancy, diverse paths, and crafted algorithms of a complete NTP implementation are needed to ensure the highest reliability, and that SNTP servers should be used only when an organization has a single, highly reliable reference clock and accepts the risks of lost synchronization if that clock fails.
Because SNTP discards most of the NTP header fields and does not maintain state, it cannot participate in the hierarchical, self-healing synchronization structure that full NTP supports. If an SNTP server becomes unsynchronized, it will immediately start serving incorrect time. If an SNTP client fails to receive a reply, it simply cannot update its clock. Therefore, SNTP is best suited to environments where time synchronization requirements are modest and the infrastructure is tightly controlled.
SNTP is for simple setups. Use it when you have one good clock and just want other computers nearby to match it. Do not use it if you need a big, reliable time network that can heal itself when clocks break.