distributed 4.4.2

CQRS/ES framework for Rust using Plain Old Rust Structs — append-only events, replay, snapshots, outbox, service bus, and pluggable infrastructure
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Wall clock. `wasm32-unknown-unknown` has no `SystemTime::now`.

use std::time::SystemTime;

pub(crate) fn now() -> SystemTime {
    #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
    {
        SystemTime::UNIX_EPOCH + std::time::Duration::from_millis(js_sys::Date::now() as u64)
    }
    #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
    {
        SystemTime::now()
    }
}