pub trait Clock:
Send
+ Sync
+ Debug {
// Required method
fn now_millis(&self) -> i64;
// Provided method
fn now_nanos(&self) -> u64 { ... }
}Expand description
A source of wall-clock time.
Implementations are shared across threads and cheap to call. Debug is required because the
clock rides in configuration that is printed when a process explains itself.
Required Methods§
Sourcefn now_millis(&self) -> i64
fn now_millis(&self) -> i64
Milliseconds since the Unix epoch.
Provided Methods§
Sourcefn now_nanos(&self) -> u64
fn now_nanos(&self) -> u64
Nanoseconds since the Unix epoch — the unit OTLP asks for.
Defaulted from Clock::now_millis, so a clock somebody writes for a test has one method.