Crate injectable_time

source ·

Structs§

  • FakeTime instances return the last value that was configured by testing code via set_ticks() or add_ticks(). Upon initialization, they return 0.
  • IncrementingFakeTime automatically increments itself by increment_by before each call to self.now().
  • MonotonicTime instances provide a monotonic clock. On Fuchsia, MonotonicTime uses fuchsia_zircon::Time::get_monotonic().
  • UtcTime instances return the Rust system clock value each time now() is called.

Traits§

  • TimeSource provides the current time in nanoseconds since the Unix epoch. A &'a dyn TimeSource can be injected into a data structure. TimeSource is implemented by UtcTime for wall-clock system time, and FakeTime for a clock that is explicitly set by testing code.