pub(crate) struct Instant {
start: f64,
}
impl Instant {
pub fn now() -> Self {
let now = js_sys::Date::new_0().get_time();
Self { start: now }
}
pub fn elapsed(&self) -> core::time::Duration {
let now = js_sys::Date::new_0().get_time();
core::time::Duration::from_millis((now - self.start) as u64)
}
}