Expand description
Canonical wall-clock for write-surface timestamp seeding.
Every write surface that stamps created / updated (or a log entry’s
timestamp) seeds it from now so all of them agree on one representation:
the current instant as a fixed-offset (UTC) DateTime. This is the type
crate::Frontmatter::created / crate::Frontmatter::updated already
hold, so callers assign it directly with no string round-trip.
Keeping this in dbmd-core (rather than re-deriving it per CLI handler)
means dbmd write, dbmd fm init, dbmd fm set, and dbmd log append all
compute “now” the same way from one place — and the thin CLI carries no
bespoke calendar logic.
§Reproducibility hook: DBMD_NOW
Because every write surface seeds its timestamps from this one function, it
is also the one place to pin the clock for deterministic, byte-for-byte
output. When the DBMD_NOW environment variable is set to an RFC3339
timestamp, now returns that instant verbatim instead of the wall clock,
so a scripted sequence of dbmd write / fm set / log invocations
produces identical created/updated fields, identical index.md /
index.jsonl (whose own updated is the max over their records), and
identical log.md headers on every run. This is the same family of build
hook as SOURCE_DATE_EPOCH: unset, behaviour is exactly the wall clock it
always was (zero product impact); set, the toolkit is reproducible — which
the agent-eval golden harness (crates/dbmd-cli/tests/agent_eval.rs) relies
on to commit EXPECTED/ trees that pin the curator’s output. A malformed
DBMD_NOW is ignored (falls back to the wall clock) rather than aborting an
otherwise-valid write.
Constants§
- NOW_
OVERRIDE_ ENV - Environment variable that pins
nowto a fixed RFC3339 instant. See the module docs (## Reproducibility hook). Unset ⇒ wall clock.
Functions§
- now
- The current instant as a fixed-offset (UTC) timestamp.