pub struct Clock {
target_dt: Duration,
real_time: Duration,
game_time: Duration,
last_tick: Instant,
last_work: Instant,
tick: u64,
average_dt: f64,
average_busy: f64,
average_variance: f64,
last_real_dt: f64,
last_game_dt: f64,
}Expand description
A type for maintaining consistent tick/frame pacing.
Fields§
§target_dt: DurationThis is the dt that the Clock tries to archive with each call of tick.
real_time: DurationThe amount of real time that has passed on the clock
game_time: DurationThe amount of game time that has passed on the clock
last_tick: InstantThe last time the clock was ticked
last_work: InstantThe last time we started performing work
tick: u64The number of ticks that have elapsed so far
average_dt: f64The average time between ticks, seconds
average_busy: f64The average amount of time within each tick in which we’re busy (i.e: not sleeping)
average_variance: f64The average amount of variance between ticks
last_real_dt: f64The time that passed between the last tick, and the tick before it
last_game_dt: f64The dt to be used for the next game tick, in game time.
Implementations§
Auto Trait Implementations§
impl Freeze for Clock
impl RefUnwindSafe for Clock
impl Send for Clock
impl Sync for Clock
impl Unpin for Clock
impl UnsafeUnpin for Clock
impl UnwindSafe for Clock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Event for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more