Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rfc868

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.

Requirements

  • C11-compatible compiler (GCC or Clang)
  • Meson ≥ 0.56 and Ninja
  • POSIX-compliant system (Linux, macOS, BSD)

Build

meson setup build
ninja -C build

Run tests:

ninja -C build test

Usage

Server

# 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

Client

# 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 3700

Protocol

Per 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.

License

GPL-3.0-or-later — see LICENSE.

About

Implementation of RFC 868

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages