pub trait Timing {
fn now() -> Self
where
Self: Sized;
fn duration_since(&self, other: &Self) -> std::time::Duration;
}
pub struct DummyTiming;
impl Timing for DummyTiming {
fn now() -> Self { DummyTiming }
fn duration_since(&self, _: &Self) -> std::time::Duration { std::time::Duration::new(0, 0) }
}
#[cfg(feature = "std")]
impl Timing for std::time::Instant {
fn now() -> Self { std::time::Instant::now() }
fn duration_since(&self, other: &Self) -> std::time::Duration { self.duration_since(*other) }
}