bitfold_host/time.rs
1use std::time::Instant;
2
3/// Abstraction over a time source to improve testability.
4pub trait Clock: Send + Sync + 'static {
5 /// Returns the current time instant.
6 fn now(&self) -> Instant;
7}
8
9/// System clock using `Instant::now()`.
10#[derive(Debug, Default)]
11pub struct SystemClock;
12
13impl Clock for SystemClock {
14 #[inline]
15 fn now(&self) -> Instant {
16 Instant::now()
17 }
18}