pub trait ClockProvider: Send + Sync {
// Required method
fn now(&self) -> DateTime<Utc>;
}Expand description
Provides the current wall-clock time, injectable for testing.
Implement this trait to decouple domain logic from Utc::now().
Use SystemClock in production and MockClock (from auths-test-utils)
in tests.
Usage:
ⓘ
fn check_expiry(clock: &dyn ClockProvider, expires_at: DateTime<Utc>) -> bool {
clock.now() < expires_at
}