mod unix;
#[cfg(unix)]
pub type DefaultNtpClock = unix::UnixNtpClock;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Error {
NoPermission,
NoAccess,
Invalid,
NoDevice,
NotSupported,
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
use Error::*;
let msg = match self {
NoPermission => "Insufficient permissions to interact with the clock.",
NoAccess => "No access to the clock.",
Invalid => "Invalid operation requested",
NoDevice => "Clock device has gone away",
NotSupported => "Clock operation requested is not supported by operating system.",
};
f.write_str(msg)
}
}
impl std::error::Error for Error {}
pub(crate) const EPOCH_OFFSET: u32 = (70 * 365 + 17) * 86400;