pub struct PtpClock { /* private fields */ }Expand description
A ClockSource backed by an injectable PtpTimeProvider.
Construct with PtpClock::with_provider when a live PTP source is
available, or PtpClock::unavailable for the stub (returns
ClockError::Unavailable from ClockSource::ptp_now_ns).
Implementations§
Source§impl PtpClock
impl PtpClock
Sourcepub fn with_provider(
anchor: ClockAnchor,
provider: Box<dyn PtpTimeProvider>,
) -> Self
pub fn with_provider( anchor: ClockAnchor, provider: Box<dyn PtpTimeProvider>, ) -> Self
Creates a PTP clock with a live time provider.
Creates a PTP clock whose ClockSource::ptp_now_ns always reports
ClockError::Unavailable.
The anchor conversions still work, so the clock is usable for offline timestamp mapping even without a live source.
Sourcepub fn anchor(&self) -> ClockAnchor
pub fn anchor(&self) -> ClockAnchor
Returns the current anchor.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PtpClock
impl !UnwindSafe for PtpClock
impl Freeze for PtpClock
impl Send for PtpClock
impl Sync for PtpClock
impl Unpin for PtpClock
impl UnsafeUnpin for PtpClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more