use std::time::{Duration, Instant, SystemTime};
#[derive(Clone, Debug)]
pub(crate) struct StopwatchStart {
start_time: SystemTime,
instant: Instant,
}
impl StopwatchStart {
pub(crate) fn now() -> Self {
Self {
start_time: SystemTime::now(),
instant: Instant::now(),
}
}
pub(crate) fn end(&self) -> StopwatchEnd {
StopwatchEnd {
start_time: self.start_time,
duration: self.instant.elapsed(),
}
}
}
#[derive(Clone, Debug)]
pub(crate) struct StopwatchEnd {
pub(crate) start_time: SystemTime,
pub(crate) duration: Duration,
}