Time server
A simple protocol for hosts to synchronize their clocks over the network
Harrenstien, K., "Time server", RFC 738, DOI 10.17487/RFC0738, October 1977, <https://www.rfc-editor.org/info/rfc738>.
@misc{rfc738,
series = {Request for Comments},
number = 738,
howpublished = {RFC 738},
publisher = {RFC Editor},
doi = {10.17487/RFC0738},
url = {https://www.rfc-editor.org/info/rfc738},
author = {K. Harrenstien},
title = {{Time server}},
pagetotal = 1,
year = 1977,
month = oct,
} RFC text
NWG/RFC# 738 KLH 31 Oct 77 42218
Network Working Group K. Harrenstien
Request for Comments: 738 SRI-KL
NIC: 42218 31 October 1977
Time Server
This note describes the Time Server protocol, as currently implemented
on ITS hosts (i.e. MIT-(AI/ML/MC/DMS)). The idea is to provide a
site-independent, machine readable date and time in as efficient and
swift a manner as possible; its motivation arises from the fact that not
all systems have a date/time clock, and all are subject to occasional
human or machine error. The use of time-servers makes it possible to
quickly confirm or correct a system's idea of the time, by making a
brief poll of several independent sites on the network.
In particular the network time server works as follows:
S: Listen on socket 37 (45 octal).
U: Connect to socket 37 [not ICP].
S: Send the time as a 32 bit binary number.
U: Close the connection.
S: Close the connection.
Note that this is not a normal ICP sequence. Rather, instead of sending
a 32-bit socket number to reconnect to, the server returns a 32-bit time
value and closes the connection. If the server is unable to determine
the time at its site, it should either refuse the connection or close it
without sending anything.
The time is the number of seconds since 0000 (midnight) 1 January 1900
GMT, such that the time 1 is 12:00:01 am on 1 January 1900 GMT; this
base will serve until the year 2036. As a further example, the most
recent leap year as of this writing began from the time 2,398,291,200
which corresponds to 0000 1 Jan 1976 GMT.
AI ELI5
On this page
§1The Need for Network Time
RFC 738 describes a Time Server protocol developed at MIT. The service is straightforward: it lets any host ask several independent time servers for the current time and use those answers to correct its own system clock.
Because not all systems had an onboard clock and because human error in setting time was common, the ARPANET needed a simple, reliable way to distribute authoritative time across the network. The Time Server protocol meets this need with minimal overhead.
Some computers on the network didn't know what time it was. A Time Server lets other computers phone home and ask, "What time is it right now?"
§2How the Protocol Works
A Time Server listens on socket 37 (octal 45). A client connects to that socket; the server does not follow the usual ICP (Initial Connection Protocol) sequence. Instead, immediately upon connection, the server sends a 32-bit binary time value and closes the connection. If the server cannot determine its own time, it refuses the connection or closes without sending data.
This is intentionally simple: no handshakes, no options, no negotiation. A client simply connects, reads the time, and disconnects.
You knock on the door, someone hands you a number that tells you what time it is, and closes the door. That's it.
§3Time Format
The time is encoded as the number of seconds since 0000 (midnight) on 1 January 1900 GMT. This epoch covers the time range until the year 2036 without overflow in a 32-bit unsigned integer. For example, the most recent leap year as of the RFC's writing began at timestamp 2,398,291,200, corresponding to 0000 on 1 January 1976 GMT.
This fixed epoch is unusual by modern standards but was practical for the 1970s. The reference point of 1900 is historical; it was chosen simply as a round date far enough in the past.
The server sends a big number: how many seconds have ticked since midnight on January 1, 1900. It's a simple way to represent any time without worrying about calendars.
§4Practical Use
A host that doubts its clock can poll several independent Time Servers and use the median or mean response to set its system time with high confidence. The protocol's simplicity and statelessness make it resilient: the server never forgets anything, and clients do not need to maintain connection state.
The RFC implies that using multiple servers is important: polling several independent sites on the network makes it possible to quickly confirm or correct a system's idea of the time and spot anomalies when one server gives an outlier.
If you ask a few different people what time it is, you can trust the answer better. You just keep calling until enough servers agree.