Trait ntp_proto::NtpClock

source ·
pub trait NtpClock: Clone + Send + 'static {
    type Error: Error;

    // Required methods
    fn now(&self) -> Result<NtpTimestamp, Self::Error>;
    fn set_frequency(&self, freq: f64) -> Result<NtpTimestamp, Self::Error>;
    fn step_clock(
        &self,
        offset: NtpDuration
    ) -> Result<NtpTimestamp, Self::Error>;
    fn disable_ntp_algorithm(&self) -> Result<(), Self::Error>;
    fn enable_ntp_algorithm(&self) -> Result<(), Self::Error>;
    fn ntp_algorithm_update(
        &self,
        offset: NtpDuration,
        poll_interval: PollInterval
    ) -> Result<(), Self::Error>;
    fn error_estimate_update(
        &self,
        est_error: NtpDuration,
        max_error: NtpDuration
    ) -> Result<(), Self::Error>;
    fn status_update(
        &self,
        leap_status: NtpLeapIndicator
    ) -> Result<(), Self::Error>;
}
Expand description

Interface for a clock settable by the ntp implementation. This needs to be a trait as a single system can have multiple clocks which need different implementation for steering and/or now.

Required Associated Types§

Required Methods§

source

fn now(&self) -> Result<NtpTimestamp, Self::Error>

source

fn set_frequency(&self, freq: f64) -> Result<NtpTimestamp, Self::Error>

source

fn step_clock(&self, offset: NtpDuration) -> Result<NtpTimestamp, Self::Error>

source

fn disable_ntp_algorithm(&self) -> Result<(), Self::Error>

source

fn enable_ntp_algorithm(&self) -> Result<(), Self::Error>

source

fn ntp_algorithm_update( &self, offset: NtpDuration, poll_interval: PollInterval ) -> Result<(), Self::Error>

source

fn error_estimate_update( &self, est_error: NtpDuration, max_error: NtpDuration ) -> Result<(), Self::Error>

source

fn status_update( &self, leap_status: NtpLeapIndicator ) -> Result<(), Self::Error>

Implementors§