lumen_core/time.rs
1//! Clock types for the tick loop, animation primitives, and script timers.
2//!
3//! `std::time::Instant::now` panics on `wasm32-unknown-unknown` and [`crate::tick::Tick::default`]
4//! calls it at boot, so this module resolves to `web_time` there and to `std::time` everywhere else.
5//! Use `lumen_core::time::{Duration, Instant}` instead of `std::time` in any crate that has to reach
6//! the browser.
7
8#[cfg(not(target_arch = "wasm32"))]
9pub use std::time::{
10 Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError, UNIX_EPOCH,
11};
12#[cfg(target_arch = "wasm32")]
13pub use web_time::{
14 Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError, UNIX_EPOCH,
15};