pub struct ClockState { /* private fields */ }Expand description
EMA-filtered clock synchronization state.
Uses a PTP-inspired 4-timestamp exchange: t1: endpoint sends request t2: controller receives request t3: controller sends response t4: endpoint receives response
offset = ((t2 - t1) + (t3 - t4)) / 2 rtt = (t4 - t1) - (t3 - t2)
Implementations§
Source§impl ClockState
impl ClockState
pub fn new() -> Self
pub fn update(&mut self, t1: u64, t2: u64, t3: u64, t4: u64)
pub fn offset_ns(&self) -> i64
pub fn rtt_ns(&self) -> u64
pub fn is_bootstrapped(&self) -> bool
pub fn samples(&self) -> u32
Sourcepub fn local_to_controller(&self, local_ns: u64) -> u64
pub fn local_to_controller(&self, local_ns: u64) -> u64
Convert a local timestamp to controller clock domain.
Sourcepub fn controller_to_local(&self, controller_ns: u64) -> u64
pub fn controller_to_local(&self, controller_ns: u64) -> u64
Convert a controller timestamp to local clock domain.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClockState
impl RefUnwindSafe for ClockState
impl Send for ClockState
impl Sync for ClockState
impl Unpin for ClockState
impl UnsafeUnpin for ClockState
impl UnwindSafe for ClockState
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