Module

std::time

source

Time: Instant, a reading of a monotonic clock; Duration, a span of time; and sleep. Duration's arithmetic, and an Instant moved by one, saturate: at the largest Duration or Instant going up, at zero going down. Both compare with Ord, so a deadline is an Instant: Instant::now() >= start.add(timeout), or start.elapsed() >= timeout.

Types

DurationA span of time, in nanoseconds: up to some 584 years.
InstantA reading of CLOCK_MONOTONIC: it never goes back, and its start is arbitrary, so only the difference between two readings means anything.

Functions

saturating_adda + b, or the largest u64 when the sum is past it.
saturating_suba - b, or 0 when b is larger.
saturating_mula * b, or the largest u64 when the product is past it.
sleepSuspends the calling thread for at least duration, sleeping on for what is left when a signal interrupts it.

Instances

Eq[Duration, Duration]Durations are equal when they are as long.
Ord[Duration, Duration]The shorter duration orders first.
Eq[Instant, Instant]Readings are equal when they are of the same moment.
Ord[Instant, Instant]The earlier reading orders first.

Function declarations

fn saturating_addsource

fn saturating_add(a: u64, b: u64) -> u64 { ... }

a + b, or the largest u64 when the sum is past it. Used by Duration and Instant; not meant for direct use.

fn saturating_subsource

fn saturating_sub(a: u64, b: u64) -> u64 { ... }

a - b, or 0 when b is larger. Used by Duration and Instant; not meant for direct use.

fn saturating_mulsource

fn saturating_mul(a: u64, b: u64) -> u64 { ... }

a * b, or the largest u64 when the product is past it. Used by Duration; not meant for direct use.

fn sleepsource

fn sleep(duration: Duration) { ... }

Suspends the calling thread for at least duration, sleeping on for what is left when a signal interrupts it.

Instance declarations

instance Eq[Duration, Duration]source

instance Eq[Duration, Duration] { ... }

Durations are equal when they are as long.

instance Ord[Duration, Duration]source

instance Ord[Duration, Duration] { ... }

The shorter duration orders first.

instance Eq[Instant, Instant]source

instance Eq[Instant, Instant] { ... }

Readings are equal when they are of the same moment.

instance Ord[Instant, Instant]source

instance Ord[Instant, Instant] { ... }

The earlier reading orders first.