Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/time/clock"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
time |
std/time |
clock.dodo |
now
Function · Source
Statically dispatched capability: C.now(&self)->Instant!TimeError. A provider must keep one identity for its clock domain and never decrease ticks. Identity allocation, OS reads and suspend policy belong to adapters.
pub fn now<C>(source: &C) -> time.Instant!time.TimeError
wall_now
Function · Source
W.wall_now(&self)->Timestamp!TimeError may jump forward or backward.
pub fn wall_now<W>(source: &W) -> time.Timestamp!time.TimeError
FakeClock
Struct · Source
pub struct FakeClock {
// Private implementation fields omitted.
}
FakeClock.new
Function · Source
pub fn new(clock_id: u64) -> FakeClock
FakeClock.starting_at
Function · Source
pub fn starting_at(clock_id: u64, ticks: time.Duration) -> FakeClock
FakeClock.now
Function · Source
pub fn now(&self) -> time.Instant!time.TimeError
FakeClock.advance
Function · Source
Failure is atomic. No sleeping or scheduler is started.
pub fn advance(&mut self, duration: &time.Duration) -> void!time.TimeError
FakeWallClock
Struct · Source
pub struct FakeWallClock {
// Private implementation fields omitted.
}
FakeWallClock.new
Function · Source
pub fn new(initial: time.Timestamp) -> FakeWallClock
FakeWallClock.wall_now
Function · Source
pub fn wall_now(&self) -> time.Timestamp!time.TimeError
FakeWallClock.set
Function · Source
pub fn set(&mut self, value: time.Timestamp)
FakeWallClock.advance
Function · Source
pub fn advance(&mut self, duration: &time.Duration) -> void!time.TimeError
Deadline
Struct · Source
pub struct Deadline {
// Private implementation fields omitted.
}
Deadline.at
Function · Source
pub fn at(target: time.Instant) -> Deadline
Deadline.instant
Function · Source
pub fn instant(&self) -> &time.Instant
Deadline.is_due
Function · Source
pub fn is_due(&self, current: &time.Instant) -> bool!time.TimeError
deadline_after
Function · Source
pub fn deadline_after<C>(source: &C, duration: &time.Duration) -> Deadline!time.TimeError
deadline_poll
Function · Source
pub fn deadline_poll<C>(deadline: &Deadline, source: &C) -> bool!time.TimeError