pub trait Clock: Send + Sync {
fn now(&self) -> u128;
}
#[cfg(feature = "std")]
pub mod system_time_clock {
use std::time::{
SystemTime,
UNIX_EPOCH,
};
use crate::common::Clock;
pub struct SystemTimeClock;
impl Clock for SystemTimeClock {
fn now(&self) -> u128 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis()
}
}
}