ntpd 1.7.2

Full-featured implementation of NTP with NTS support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use ntp_proto::NtpTimestamp;

// Epoch offset between NTP and UNIX timescales
pub(crate) const EPOCH_OFFSET: u32 = (70 * 365 + 17) * 86400;

pub(crate) fn convert_net_timestamp(ts: timestamped_socket::socket::Timestamp) -> NtpTimestamp {
    NtpTimestamp::from_seconds_nanos_since_ntp_era(
        EPOCH_OFFSET.wrapping_add(ts.seconds as _),
        ts.nanos,
    )
}

pub(crate) fn convert_clock_timestamp(ts: clock_steering::Timestamp) -> NtpTimestamp {
    NtpTimestamp::from_seconds_nanos_since_ntp_era(
        EPOCH_OFFSET.wrapping_add(ts.seconds as _),
        ts.nanos,
    )
}