[][src]Module tokio_timer::clock

A configurable source of time.

This module provides an API to get the current instant in such a way that the source of time may be configured. This allows mocking out the source of time in tests.

The now function returns the current Instant. By default, it delegates to Instant::now.

The source of time used by now can be configured by implementing the Now trait and passing an instance to with_default.

Structs

Clock

A handle to a source of time.

DefaultGuard

A guard that resets the current Clock to None when dropped.

Traits

Now

Returns Instant values representing the current instant in time.

Functions

now

Returns an Instant corresponding to "now".

set_default

Sets clock as the default clock, returning a guard that unsets it on drop.

with_default

Set the default clock for the duration of the closure.