pub struct DriftFit {
pub t_ref: f64,
pub offset: f64,
pub drift: f64,
}Expand description
Fitted linear clock model offset(t_local) = offset + drift * (t_local - t_ref).
Snapshot values can be cached atomically on the hot pull path so
DriftFit::offset_for_remote runs with zero locks.
Fields§
§t_ref: f64Reference local timestamp (seconds).
offset: f64Fitted clock offset local - remote at t_ref (seconds).
drift: f64Fitted relative clock drift d(offset)/d(t_local) (seconds per second).
Implementations§
Source§impl DriftFit
impl DriftFit
Sourcepub fn offset_for_remote(self, remote_ts: f64) -> f64
pub fn offset_for_remote(self, remote_ts: f64) -> f64
Evaluate the smooth offset local - remote for a sample carrying
remote_ts on the source clock.
Solves t_local - remote_ts = offset + drift * (t_local - t_ref) for
t_local - remote_ts, eliminating step jumps between bursts.
Sourcepub fn offset_at_local(self, local_t: f64) -> f64
pub fn offset_at_local(self, local_t: f64) -> f64
Evaluate the smooth offset local - remote at local clock time local_t.
Trait Implementations§
impl Copy for DriftFit
impl StructuralPartialEq for DriftFit
Auto Trait Implementations§
impl Forget for DriftFit
impl Freeze for DriftFit
impl Move for DriftFit
impl RefUnwindSafe for DriftFit
impl Send for DriftFit
impl Sync for DriftFit
impl Unpin for DriftFit
impl UnsafeUnpin for DriftFit
impl UnwindSafe for DriftFit
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