bigben/fake_clock

A fake clock for manipulating the flow of time.

Types

A fake clock.

pub opaque type FakeClock

Functions

pub fn advance(clock: FakeClock, duration: Duration) -> Nil

Advances the given FakeClock by the specified duration.

pub fn new() -> FakeClock

Returns a new FakeClock.

The current time will be now in UTC.

pub fn new_at(now: Time) -> FakeClock

Returns a new FakeClock at the given time.

pub fn now(clock: FakeClock) -> Time

Returns the current time on the given FakeClock.

pub fn set_now(clock: FakeClock, now: Time) -> Nil

Sets the current time on the given FakeClock to the specified value.

Search Document