Crate gametime

source ·
Expand description

This crate provides TimeSpan and TimeStamp types for working with time in ergonomic way in game engines.

TimeSpan is a type that represents a time span in nanoseconds. Similar to std::time::Duration, but smaller and thus faster.

TimeStamp is a type that represents a point in time in nanoseconds, relative to reference point.

Clock is a type that represents a clock to measure time and steps.

Frequency and FrequencyTicker allow exact frequency ticker using rational values.

§Features

  • std - enables std support, including Clock and ClockStep types.
  • global_reference - enables [TimeStamp::now] function to get time stamp relative to global reference point that is initialized by first call to [TimeStamp::now].
  • serde - enables serde support for TimeSpan and Frequency.

Macros§

  • Converts human-readable expression into TimeSpan.
  • Converts human-readable expression into TimeSpan. Shortcut for timespan!.

Structs§

  • Time measuring device. Uses system monotonic clock counter and yields ClockSteps for each step.
  • Time measuring device. Uses system monotonic clock counter and yields ClockSteps for each step.
  • Result of Clock step. Contains time stamp corresponding to “now” and time span since previous step.
  • Represents frequency. Able to accurately represent any rational frequency.
  • Iterator over ticks from FrequencyTicker.
  • An interval in between time stamps. This type is used to represent durations with nanosecond precision.
  • A fixed point in time relative to the reference point in time.

Traits§

  • This trait adds methods to integers to convert values into Frequencys.
  • This trait adds methods to integers to convert values into TimeSpans.