1//! Cross platform time utilities.
23pub use std::time::SystemTime as Time;
4pub use web_time::{Duration, Instant};
56/// Returns the current system time (UTC+0).
7#[cfg(any(feature = "system", feature = "web"))]
8pub fn now() -> Time {
9#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
10{
11 Time::now()
12 }
13#[cfg(all(target_family = "wasm", target_os = "unknown"))]
14{
15use web_time::web::SystemTimeExt;
16 web_time::SystemTime::now().to_std()
17 }
18}
1920/// Returns a dummy time on environments that do not support time.
21#[cfg(not(any(feature = "system", feature = "web")))]
22pub fn now() -> Time {
23 Time::UNIX_EPOCH
24}