pub struct TimeAdapter { /* private fields */ }Expand description
Converts between simulation ticks and wall-clock time.
The core simulation is purely tick-based for determinism.
Game integrations use TimeAdapter to display real-time
values and schedule events in human-readable units.
Implementations§
Source§impl TimeAdapter
impl TimeAdapter
Sourcepub fn ticks_to_seconds(&self, ticks: u64) -> f64
pub fn ticks_to_seconds(&self, ticks: u64) -> f64
Convert ticks to seconds.
Sourcepub fn seconds_to_ticks(&self, seconds: f64) -> u64
pub fn seconds_to_ticks(&self, seconds: f64) -> u64
Convert seconds to ticks, rounded to nearest.
Sourcepub fn duration_to_ticks(&self, duration: Duration) -> u64
pub fn duration_to_ticks(&self, duration: Duration) -> u64
Convert a Duration to ticks, rounded to nearest.
Sourcepub fn ticks_to_duration(&self, ticks: u64) -> Duration
pub fn ticks_to_duration(&self, ticks: u64) -> Duration
Convert ticks to a Duration.
Sourcepub const fn ticks_per_second(&self) -> f64
pub const fn ticks_per_second(&self) -> f64
The configured tick rate.
Trait Implementations§
Source§impl Clone for TimeAdapter
impl Clone for TimeAdapter
Source§fn clone(&self) -> TimeAdapter
fn clone(&self) -> TimeAdapter
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 TimeAdapter
impl Debug for TimeAdapter
impl Copy for TimeAdapter
Auto Trait Implementations§
impl Freeze for TimeAdapter
impl RefUnwindSafe for TimeAdapter
impl Send for TimeAdapter
impl Sync for TimeAdapter
impl Unpin for TimeAdapter
impl UnsafeUnpin for TimeAdapter
impl UnwindSafe for TimeAdapter
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