Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + Debug {
    // Required methods
    fn now_millis(&self) -> u64;
    fn now_rfc3339(&self) -> String;

    // Provided method
    fn now_secs(&self) -> i64 { ... }
}
Expand description

A time provider for getting current timestamps.

This trait abstracts over time sources to enable:

  • Controllable time in tests (fixed starting point, manual advance)
  • Monotonic timestamps within a single clock instance

Required Methods§

Source

fn now_millis(&self) -> u64

Returns the current time as milliseconds since Unix epoch.

Source

fn now_rfc3339(&self) -> String

Returns the current time as an RFC3339-formatted string.

Provided Methods§

Source

fn now_secs(&self) -> i64

Get current time as seconds since Unix epoch.

Convenience method that converts milliseconds to seconds.

Implementors§

Source§

impl Clock for FixedClock

Available on crate features testing only.
Source§

impl Clock for SystemClock