aboutsummaryrefslogtreecommitdiff
path: root/crates/web-time-compat/src/wasm.rs
blob: 37d2198ce08b478b82fd22037bd2a900f5afbbab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Wasm-specific time functionality.

// If we've forbidden `now` elsewhere in our project, we enable it here.
#![allow(clippy::disallowed_methods)]

pub use web_time::Instant;

impl crate::SystemTimeExt for std::time::SystemTime {
    fn get() -> std::time::SystemTime {
        use web_time::web::SystemTimeExt as _;
        let now = web_time::SystemTime::now();
        now.to_std()
    }
}

impl crate::InstantExt for Instant {
    fn get() -> crate::Instant {
        Instant::now()
    }
}