pub struct TimeEngine { /* private fields */ }Expand description
Time Engine - manages dual clocks and temporal control
Implementations§
Source§impl TimeEngine
impl TimeEngine
Sourcepub fn with_config(config: TimeEngineConfig) -> Self
pub fn with_config(config: TimeEngineConfig) -> Self
Create a new Time Engine with custom configuration
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Advance clocks by one tick This is the core tick function - MUST be called every tick
Sourcepub fn τp(&self) -> PerceptualTime
pub fn τp(&self) -> PerceptualTime
Get current perceptual time (τp)
pub fn tau_p(&self) -> PerceptualTime
pub fn tau_s(&self) -> StateTime
Sourcepub fn reality_window(&self) -> RealityWindow
pub fn reality_window(&self) -> RealityWindow
Get current reality window
Sourcepub fn classify_time(&self, t: StateTime) -> TimePosition
pub fn classify_time(&self, t: StateTime) -> TimePosition
Classify a time relative to the reality window
Sourcepub fn update_from_packet(
&mut self,
peer: NodeId,
remote_time: StateTime,
seq: u16,
)
pub fn update_from_packet( &mut self, peer: NodeId, remote_time: StateTime, seq: u16, )
Update network model from a received packet
Sourcepub fn record_reorder(&mut self, depth: u32)
pub fn record_reorder(&mut self, depth: u32)
Record packet reorder
Sourcepub fn record_loss(&mut self, lost: u32, total: u32)
pub fn record_loss(&mut self, lost: u32, total: u32)
Record packet loss
Sourcepub fn stability_score(&self) -> f64
pub fn stability_score(&self) -> f64
Get network stability score
Sourcepub fn correction_weight(&self, delay: Duration) -> f64
pub fn correction_weight(&self, delay: Duration) -> f64
Calculate correction weight for a late event Weight decreases as event gets older
Sourcepub fn network(&self) -> &NetworkModel
pub fn network(&self) -> &NetworkModel
Get reference to network model
Sourcepub fn state_clock_mut(&mut self) -> &mut StateClock
pub fn state_clock_mut(&mut self) -> &mut StateClock
Get mutable reference to state clock (for convergence control)
Sourcepub fn drift_ms(&self) -> i64
pub fn drift_ms(&self) -> i64
Get the current time drift in milliseconds.
This returns the drift between the local state clock and the network consensus time. A positive value means the local clock is ahead, negative means it’s behind.
For now, this returns 0 as a placeholder. In a full implementation, this would track the difference between local τs and the network consensus time based on peer synchronization.