Struct ClientClock

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn rtt_seconds(&self) -> Option<f64>

Source

pub fn jitter_seconds(&self) -> f64

Source

pub fn render_delay_ticks(&self, hz: u16) -> u32

Source

pub fn estimated_tick(&self, local_us: u64, hz: u16) -> Option<f64>

Source

pub fn render_tick(&self, local_us: u64, hz: u16) -> Option<f64>

Trait Implementations§

Source§

impl Clone for ClientClock

Source§

fn clone(&self) -> ClientClock

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientClock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ClientClock

Source§

fn default() -> ClientClock

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.