Crate injectable_time

source ·

Structs§

  • BootInstant instances provide a monotonic clock. On Fuchsia, BootInstant uses zx::BootInstant::get().
  • 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().
  • MonotonicInstant instances provide a monotonic clock. On Fuchsia, MonotonicInstant uses zx::MonotonicInstant::get().
  • UtcInstant 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 UtcInstant for wall-clock system time, and FakeTime for a clock that is explicitly set by testing code.