pub struct WorldClock {
pub tick: WorldTick,
pub epoch: DateTime<Utc>,
pub wall_time: DateTime<Utc>,
pub hz: f64,
pub time_scale: f64,
}Expand description
World clock — drives the simulation cadence.
Each call to advance increments the tick counter and
updates wall-time. The hz field controls the nominal tick rate, while
time_scale allows simulated time to run faster or slower than real time.
Fields§
§tick: WorldTickCurrent tick number.
epoch: DateTime<Utc>UTC timestamp of tick zero.
wall_time: DateTime<Utc>Wall-clock time of the most recent tick.
hz: f64Nominal ticks per second.
time_scale: f64Multiplier for simulated time (1.0 = real-time).
Implementations§
Source§impl WorldClock
impl WorldClock
Sourcepub fn elapsed_seconds(&self) -> f64
pub fn elapsed_seconds(&self) -> f64
Real seconds elapsed since epoch.
Sourcepub fn simulated_seconds(&self) -> f64
pub fn simulated_seconds(&self) -> f64
Simulated seconds = ticks / hz * time_scale.
Trait Implementations§
Source§impl Clone for WorldClock
impl Clone for WorldClock
Source§fn clone(&self) -> WorldClock
fn clone(&self) -> WorldClock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorldClock
impl Debug for WorldClock
Source§impl Default for WorldClock
impl Default for WorldClock
Source§impl<'de> Deserialize<'de> for WorldClock
impl<'de> Deserialize<'de> for WorldClock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WorldClock
impl RefUnwindSafe for WorldClock
impl Send for WorldClock
impl Sync for WorldClock
impl Unpin for WorldClock
impl UnsafeUnpin for WorldClock
impl UnwindSafe for WorldClock
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