1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! The single wall-clock surface — one canonical `now_ms()`.
//!
//! Across the workspace a dozen modules each grew their own private
//! `now_ms()` that read `SystemTime::now()`, subtracted `UNIX_EPOCH`, and
//! returned the elapsed milliseconds — the `Date.now()` analogue the TS sources
//! lean on. They drifted in return type (`f64` here, `i64` there, `u64`
//! elsewhere) and in how they clamp a pre-epoch clock. This module collapses
//! all of that into one place so the clock-read logic lives once.
//!
//! The canonical return is [`u64`] — it matches the majority of call sites and
//! is the natural type for an always-non-negative epoch-millisecond count. The
//! few `f64`/`i64` consumers cast the `u64` at their own boundary (the value is
//! well within the lossless range of both for any realistic clock).
use ;
/// Current wall-clock time in whole epoch milliseconds — the canonical
/// `Date.now()` analogue.
///
/// A clock set before the Unix epoch (or any `duration_since` error) clamps to
/// `0` rather than producing a wrapped or negative timestamp, matching the
/// defensive `.unwrap_or(0)` every former local copy used.