Skip to main content

TimeEngine

Struct TimeEngine 

Source
pub struct TimeEngine { /* private fields */ }
Expand description

Time Engine - manages dual clocks and temporal control

Implementations§

Source§

impl TimeEngine

Source

pub fn new() -> Self

Create a new Time Engine with default configuration

Source

pub fn with_config(config: TimeEngineConfig) -> Self

Create a new Time Engine with custom configuration

Source

pub fn tick(&mut self)

Advance clocks by one tick This is the core tick function - MUST be called every tick

Source

pub fn τp(&self) -> PerceptualTime

Get current perceptual time (τp)

Source

pub fn tau_p(&self) -> PerceptualTime

Source

pub fn τs(&self) -> StateTime

Get current state time (τs)

Source

pub fn tau_s(&self) -> StateTime

Source

pub fn Hp(&self) -> Duration

Get current prediction horizon

Source

pub fn Hc(&self) -> Duration

Get current correction horizon

Source

pub fn reality_window(&self) -> RealityWindow

Get current reality window

Source

pub fn classify_time(&self, t: StateTime) -> TimePosition

Classify a time relative to the reality window

Source

pub fn update_from_packet( &mut self, peer: NodeId, remote_time: StateTime, seq: u16, )

Update network model from a received packet

Source

pub fn record_reorder(&mut self, depth: u32)

Record packet reorder

Source

pub fn record_loss(&mut self, lost: u32, total: u32)

Record packet loss

Source

pub fn stability_score(&self) -> f64

Get network stability score

Source

pub fn correction_weight(&self, delay: Duration) -> f64

Calculate correction weight for a late event Weight decreases as event gets older

Source

pub fn network(&self) -> &NetworkModel

Get reference to network model

Source

pub fn state_clock_mut(&mut self) -> &mut StateClock

Get mutable reference to state clock (for convergence control)

Trait Implementations§

Source§

impl Default for TimeEngine

Source§

fn default() -> Self

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> 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, 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.