Trait Clock

Source
pub trait Clock: Send + Sync {
    // Required methods
    fn now(&self) -> Instant;
    fn unix_now(&self) -> Timestamp;
}
Expand description

A pluggable time source.

Used by the authorizer, cache, and delegation verifier so that tests can use a MockClock to drive deterministic TTL behavior.

§Future

This trait is currently held as Arc<dyn Clock> in the cache and policy watcher (cheap but not free). Switching the call sites to impl Clock generics would let SystemClock (zero-sized) live on the stack and avoid the Arc/dyn indirection entirely. Tracked for v0.3.

Required Methods§

Source

fn now(&self) -> Instant

Monotonic instant (for measuring elapsed time).

Source

fn unix_now(&self) -> Timestamp

Wall-clock unix seconds (for absolute-time checks like exp).

Implementors§