1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use chrono::{DateTime, Local}; pub struct Timer(DateTime<Local>); impl std::ops::Deref for Timer { type Target = DateTime<Local>; fn deref(&self) -> &Self::Target { &self.0 } } impl Timer { pub(crate) fn new() -> Self { return Self(Local::now()); } }