Skip to main content

Module time

Module time 

Source
Expand description

Time source for capture envelopes. Real wall clock by default; can be pinned for deterministic test output via either:

  • the SECUNIT_CAPTURE_FIXED_TIME env var (for CLI integration tests that span a child process), or
  • the in-process set_fixed_time_for_tests helper (for unit tests that don’t want to fight other parallel tests for the env var).

Structs§

FixedTimeGuard

Functions§

now_iso8601
Returns the current UTC instant, formatted as YYYY-MM-DDTHH:MM:SSZ (no fractional seconds — capture envelopes round to whole seconds so hashes are stable across machines with different clock resolutions).
set_fixed_time_for_tests
Pin the clock for the duration of the returned guard. The guard holds a process-wide mutex so concurrent time-pinning tests serialize cleanly — without this, rust’s parallel test runner can have one test’s “drop” race against another test’s “read”.