Implementation of the RFC 868 Time Protocol in C.
The Time Protocol provides a machine-readable timestamp as a 32-bit unsigned integer counting seconds since midnight, January 1, 1900 (UTC). It operates over TCP and UDP on port 37.
- C11-compatible compiler (GCC or Clang)
- Meson ≥ 0.56 and Ninja
- POSIX-compliant system (Linux, macOS, BSD)
meson setup build
ninja -C buildRun tests:
ninja -C build test# TCP server on port 37 (requires root for privileged ports)
sudo ./build/src/rfc868 server
# UDP server on a non-privileged port
./build/src/rfc868 server --udp --port 3700# Query a server over TCP
./build/src/rfc868 client --host 127.0.0.1 --port 3700
# Query a server over UDP
./build/src/rfc868 client --udp --host 127.0.0.1 --port 3700Per RFC 868:
- TCP: server accepts a connection, writes a 32-bit big-endian timestamp, then closes the connection.
- UDP: server responds to any incoming datagram with a 32-bit big-endian timestamp.
The 32-bit value counts seconds elapsed since 00:00:00 UTC, January 1, 1900. To convert to Unix time, subtract 2208988800.
GPL-3.0-or-later — see LICENSE.