Crate injectable_time

Source

Structs§

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

Traits§

TimeSource
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.