Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn unix_secs(&self) -> u64;

    // Provided method
    fn now_rfc3339(&self) -> String { ... }
}
Expand description

A source of wall-clock time. Returns both a monotonic-ish epoch instant (for deadline math) and an RFC-3339 rendering (for audit records).

Required Methods§

Source

fn unix_secs(&self) -> u64

Seconds since the Unix epoch (UTC).

Provided Methods§

Source

fn now_rfc3339(&self) -> String

The current time as an RFC-3339 / ISO-8601 UTC string, e.g. 2026-05-30T22:18:30Z. Default impl derives it from Clock::unix_secs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§