pub struct NtpClock { /* private fields */ }Expand description
A ClockSource anchored to the host wall clock (NTP fallback).
On construction, sample index 0 is anchored to the current wall-clock
time. The anchor may be moved later with NtpClock::reanchor (e.g. when
an audio device reports its actual start time) and inspected with
NtpClock::anchor.
Implementations§
Source§impl NtpClock
impl NtpClock
Sourcepub fn new(sample_rate: u32) -> Result<Self>
pub fn new(sample_rate: u32) -> Result<Self>
Creates a clock anchored at sample 0 to the current wall-clock time.
§Errors
ClockError::InvalidSampleRatewhensample_rate == 0.ClockError::NotSyncedwhen the system clock is before the epoch.
Sourcepub fn with_anchor(anchor: ClockAnchor) -> Self
pub fn with_anchor(anchor: ClockAnchor) -> Self
Creates a clock over a pre-built anchor (e.g. restored from a session).
Sourcepub fn anchor(&self) -> ClockAnchor
pub fn anchor(&self) -> ClockAnchor
Returns the current anchor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NtpClock
impl RefUnwindSafe for NtpClock
impl Send for NtpClock
impl Sync for NtpClock
impl Unpin for NtpClock
impl UnsafeUnpin for NtpClock
impl UnwindSafe for NtpClock
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