pub struct NetworkClock { /* private fields */ }Expand description
Aggregates multiple partial or complete time sources into a current network-time reading.
Implementations§
Source§impl NetworkClock
impl NetworkClock
Sourcepub fn update_source(
&mut self,
source: &str,
priority: u64,
time: PartialNetworkTime,
updated_mono_ms: u64,
anchor_mono_ns: u64,
ttl_ms: Option<u64>,
)
pub fn update_source( &mut self, source: &str, priority: u64, time: PartialNetworkTime, updated_mono_ms: u64, anchor_mono_ns: u64, ttl_ms: Option<u64>, )
Inserts or replaces a named source used when assembling current network time.
Sourcepub fn remove_source(&mut self, source: &str)
pub fn remove_source(&mut self, source: &str)
Removes a previously registered source by identifier.
Sourcepub fn prune_expired(&mut self, now_mono_ms: u64)
pub fn prune_expired(&mut self, now_mono_ms: u64)
Drops sources whose optional TTL has expired relative to now_mono_ms.
Sourcepub fn current_time(&self, now_mono_ns: u64) -> Option<NetworkTimeReading>
pub fn current_time(&self, now_mono_ns: u64) -> Option<NetworkTimeReading>
Returns the best current reading by preferring complete sources, then merging partial ones.
Trait Implementations§
Source§impl Clone for NetworkClock
impl Clone for NetworkClock
Source§impl Debug for NetworkClock
impl Debug for NetworkClock
Auto Trait Implementations§
impl Freeze for NetworkClock
impl RefUnwindSafe for NetworkClock
impl Send for NetworkClock
impl Sync for NetworkClock
impl Unpin for NetworkClock
impl UnsafeUnpin for NetworkClock
impl UnwindSafe for NetworkClock
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