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
56
57
58
59
60
61
62
//! Best-effort wall-clock reads that never panic, on every target hexser compiles for.
//!
//! `std::time::SystemTime::now()` is not a total function. On `wasm32-unknown-unknown` std
//! routes time through its `unsupported` platform layer, where `now()` is a hard
//! `panic!("time not implemented on this platform")`. hexser stamps `GraphMetadata::created_at`
//! on the universal graph-construction path, so that trap fired on the first touch of
//! `HexGraph::current()` in a browser — in code that had compiled clean, which is why a
//! build-only check never caught it.
//!
//! Every hexser timestamp is informational metadata, never a correctness input, so the honest
//! answer on a clockless target is "unknown" (0) rather than a trap that takes the module down.
//! WASI (`wasm32-wasip1`) has a real clock and takes the normal path, as does every native
//! target.
//!
//! Reading a real browser clock would mean `js-sys`/`wasm-bindgen`, which would cost the
//! dependency-free WASM story documented in the README for one metadata field. Callers that
//! need a true browser timestamp should stamp it themselves at the edge.
//!
//! Revision History
//! - 2026-09-11T00:00:00Z @AI: Initial clockless-target guard — single site for the `SystemTime::now()` panic on wasm32-unknown-unknown, shared by graph metadata and the AI RFC3339 formatter.
/// Seconds since the Unix epoch, best-effort.
///
/// Returns 0 rather than panicking in both degenerate cases: a clock set before the epoch, and
/// a target with no clock at all.
pub
/// Seconds since the Unix epoch on a target whose std has no clock: always 0.
///
/// `wasm32-unknown-unknown` (the browser target) has no host clock behind std, and its
/// `SystemTime::now()` panics rather than returning an error, so the call is compiled out
/// entirely instead of guarded at runtime.
pub