pub struct UtcClock { /* private fields */ }Expand description
The clock: at most one anchor.
Implementations§
Source§impl UtcClock
impl UtcClock
Sourcepub fn utc_at(&self, now_us: u64) -> Option<i64>
pub fn utc_at(&self, now_us: u64) -> Option<i64>
UTC at now_us, or None before the first anchor.
Sourcepub fn mono_for_utc(&self, utc_us: i64) -> Option<u64>
pub fn mono_for_utc(&self, utc_us: i64) -> Option<u64>
The monotonic instant at which UTC reaches utc_us.
Sourcepub fn offer(
&mut self,
sample: UtcSample,
source: ClockSource,
now_us: u64,
policy: OfferPolicy,
) -> OfferOutcome
pub fn offer( &mut self, sample: UtcSample, source: ClockSource, now_us: u64, policy: OfferPolicy, ) -> OfferOutcome
Offer a measurement; the anchor changes per the replacement rule.
A more trusted source replaces at once; a less trusted one only when
policy.allow_downgrade. For the same source: a reading that disagrees
with the prediction by more than the two error bars together is a clock
step and is adopted immediately; otherwise it replaces the anchor when
it is at least as precise or the anchor is older than
policy.resync_us.
Trait Implementations§
impl Copy for UtcClock
impl Eq for UtcClock
impl StructuralPartialEq for UtcClock
Auto Trait Implementations§
impl Freeze for UtcClock
impl RefUnwindSafe for UtcClock
impl Send for UtcClock
impl Sync for UtcClock
impl Unpin for UtcClock
impl UnsafeUnpin for UtcClock
impl UnwindSafe for UtcClock
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