bigben/fake_clock

A fake clock for manipulating the flow of time.

Types

A fake clock.

pub opaque type FakeClock

Values

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

Advances the given FakeClock by the specified duration.

pub fn new() -> FakeClock

Returns a new FakeClock.

The current time will be the instant the clock was created.

pub fn new_at(now: timestamp.Timestamp) -> FakeClock

Returns a new FakeClock at the given time.

pub fn now(clock: FakeClock) -> timestamp.Timestamp

Returns the current time on the given FakeClock.

pub fn set_now(clock: FakeClock, now: timestamp.Timestamp) -> Nil

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

Search Document