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
use *;
/// Returns a monotonic millisecond timestamp suitable for
/// profiling measurements.
///
/// Delegates to `Performance::now()` when available, which is
/// monotonic per-spec, sub-millisecond resolution, and shared
/// across all `Worker` scopes in the same browsing context.
/// Falls back to `Date.now()` (non-monotonic, but always
/// available) when `performance.now()` is missing — the
/// fallback only fires in worklets or non-browser wasm
/// runtimes.
///
/// On non-wasm test runners where the browser API surface is
/// absent the first call may unwind; the `FALLBACK_MS` cell
/// then caches the result of a process-local monotonic clock
/// so subsequent calls don't re-trigger the web-sys lazy
/// initialiser (which would poison once-cell across the rest
/// of the test process).
///
/// # Returns
///
/// - `f64` - A monotonically-increasing millisecond timestamp.
/// Always `>= 0.0`.
/// Fallback millisecond clock anchored at this thread's first call.
/// Helper body of the `process_local_ms` free function.
///
/// # Returns
///
/// - `f64` - A non-negative monotonically-increasing millisecond value.