pub trait Clock {
type Error: Error;
// Required methods
fn now(&self) -> Timestamp;
fn step(&mut self, offset_nanos: i64) -> Result<Timestamp, Self::Error>;
fn set_frequency(
&mut self,
adjustment: ScaledPpm,
) -> Result<Timestamp, Self::Error>;
}Expand description
A readable and adjustable PTP hardware clock.
The clock must be the same time domain that produces packet timestamps. Frequency adjustments are absolute relative to the nominal frequency, rather than cumulative.
Required Associated Types§
Required Methods§
Sourcefn step(&mut self, offset_nanos: i64) -> Result<Timestamp, Self::Error>
fn step(&mut self, offset_nanos: i64) -> Result<Timestamp, Self::Error>
Step the clock and return a timestamp sampled near the change.
A positive offset moves the clock forward. Steps use whole nanoseconds even when timestamp observations have subnanosecond resolution: stepping is a coarse correction, while frequency adjustment preserves fine steering.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".