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 now in UTC.

pub fn new_at(now: birl.Time) -> FakeClock

Returns a new FakeClock at the given time.

pub fn now(clock: FakeClock) -> birl.Time

Returns the current time on the given FakeClock.

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

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

Search Document