1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
//literally just a wrapper for std time on desktop
use std::time;
#[derive(Copy,Clone)]
pub struct Instant{
inst:time::Instant,
}
impl Instant{
pub fn now()->Self{
Self{
inst:time::Instant::now(),
}
}
pub fn elapsed(&self) -> Duration{
Duration { dur: self.inst.elapsed() }
}
}
pub struct Duration{
dur:time::Duration,
}
impl Duration{
pub fn as_millis(&self)-> u128{
self.dur.as_millis()
}
}