okbot_core/clock.rs
1//! Time source.
2
3use jiff::Timestamp;
4
5/// A source of the current time, replaceable in tests.
6pub trait Clock: Send + Sync {
7 /// Now, in UTC.
8 fn now(&self) -> Timestamp;
9}
10
11/// The system clock.
12#[derive(Debug, Clone, Copy, Default)]
13pub struct SystemClock;
14
15impl Clock for SystemClock {
16 fn now(&self) -> Timestamp {
17 Timestamp::now()
18 }
19}