Skip to main content

Module sntp

Module sntp 

Source
Expand description

Simple Network Time Protocol (SNTPv4, RFC 4330) client messages.

use oxstack_net::sntp;
let request = sntp::request();
// send `request` over UDP to port 123, receive `reply`, then:
let t = sntp::parse_reply(&reply).unwrap();
assert!(t.unix_seconds > 1_700_000_000);

Structs§

ServerTime
Time reported by a server.

Enums§

Error
Why a reply was rejected.

Constants§

PACKET_LEN
Size of an SNTP message without extensions.
PORT
UDP port SNTP servers listen on.

Functions§

parse_reply
Validates a reply and extracts its transmit timestamp.
request
A client request: just the header byte, everything else zero (RFC 4330 §5 allows clients to leave the transmit timestamp zero).