pub struct ClientClock { /* private fields */ }Expand description
Four-slot correlated clock estimator. See the module recipe for transport, time-domain, render sampling and reconnect responsibilities.
Implementations§
Source§impl ClientClock
impl ClientClock
Sourcepub fn probe(&mut self, local_us: u64) -> Option<(u32, u64)>
pub fn probe(&mut self, local_us: u64) -> Option<(u32, u64)>
Retain a probe with a wrapping u32 nonce. Timestamps through 2^53 µs inclusive are accepted; an invalid time changes nothing. The fifth probe overwrites the oldest slot regardless of age, preserving legacy policy.
Sourcepub fn observe(
&mut self,
nonce: u32,
client_us: u64,
receive_us: u64,
send_us: u64,
tick: u32,
now_us: u64,
) -> bool
pub fn observe( &mut self, nonce: u32, client_us: u64, receive_us: u64, send_us: u64, tick: u32, now_us: u64, ) -> bool
Compatibility wrapper: true exactly when Self::observe_detailed
accepts the reply. False preserves probes and all estimator state.
Sourcepub fn observe_detailed(
&mut self,
nonce: u32,
client_us: u64,
receive_us: u64,
send_us: u64,
tick: u32,
now_us: u64,
) -> Result<(), ClockSampleIgnored>
pub fn observe_detailed( &mut self, nonce: u32, client_us: u64, receive_us: u64, send_us: u64, tick: u32, now_us: u64, ) -> Result<(), ClockSampleIgnored>
Observe a session-validated reply with typed rejection reasons. Same
acceptance, estimator, expiry and unwrapping rules as Self::observe.
Failure changes nothing, so a malformed echo cannot consume a valid
pending probe; even expired probes remain until overwritten or reset.
See the module’s runnable exchange/render/reset recipe.
Sourcepub fn diagnostics(&self, local_us: u64, hz: u16) -> ClockDiagnostics
pub fn diagnostics(&self, local_us: u64, hz: u16) -> ClockDiagnostics
Inspect retained probes, smoothed RTT/offset age, jitter and delay without
expiring probes or advancing the estimator. Supply the same local time
domain used for probe/observe; age is unknown before the first sample.
hz selects delay exactly as Self::render_delay_ticks does. Estimate
methods still independently require 1..=1000 Hz and valid local time.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear probes, estimates, jitter, freshness and tick anchor for reconnect.
The first accepted new probe rebases time/ticks, even to lower values.
Keeps the nonce cursor to avoid immediate reuse, but wrapping/recreated
clocks can reuse nonces: validate the outer session before observation.
This is not a session/epoch authenticator. Discard old-session traffic and
reset the consumer’s history and TickUnwrapper at the same boundary.
pub fn rtt_seconds(&self) -> Option<f64>
pub fn jitter_seconds(&self) -> f64
pub fn render_delay_ticks(&self, hz: u16) -> u32
pub fn estimated_tick(&self, local_us: u64, hz: u16) -> Option<f64>
pub fn render_tick(&self, local_us: u64, hz: u16) -> Option<f64>
Trait Implementations§
Source§impl Clone for ClientClock
impl Clone for ClientClock
Source§fn clone(&self) -> ClientClock
fn clone(&self) -> ClientClock
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more