pub trait Clock: Send + Sync {
// Required method
fn now(&self) -> u64;
}Expand description
Source of “now”, injectable so replay-protection tests are deterministic.
Returns unix seconds (the number of whole seconds since the Unix epoch);
this keeps the crate no_std + alloc compatible (spec.md §1) — there is
no wall clock in the no_std ecosystem, so callers on such targets supply
their own implementation (e.g. from a platform RTC or NTP-synced counter).
Only providers whose scheme signs a timestamp use a clock; for others
(GitHub, Shopify) no Clock is consulted.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Clock for SystemClock
Available on crate feature
std only.