a3b9293cd9
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
14 lines
432 B
Rust
14 lines
432 B
Rust
//! Platform-specific wall-clock time sources.
|
|
|
|
/// Abstracts platform-specific wall-clock time.
|
|
///
|
|
/// Native: backed by `std::time::SystemTime`.
|
|
/// WASM: backed by `js_sys::Date::now()`.
|
|
pub trait PlatformTime: Send + Sync + 'static {
|
|
/// Returns the current Unix timestamp in seconds.
|
|
fn now_unix_secs(&self) -> u64;
|
|
|
|
/// Returns the current Unix timestamp in milliseconds.
|
|
fn now_unix_millis(&self) -> u128;
|
|
}
|