Skip to main content

Module time

Module time 

Source
Expand description

Tiny time helpers shared by the harness adapter (super::super::harnesses::claude) and the burn run driver ([super::super::commands::run]).

Both call sites need the same two operations:

  • iso_now — current wall-clock in YYYY-MM-DDTHH:MM:SS.mmmZ format, matching new Date().toISOString() in the TS sibling.
  • civil_from_days — Howard Hinnant’s days-since-epoch → (Y, M, D) conversion. Pulled out so we don’t pay a chrono / time dependency for two tiny call sites.

Until D5 / D6 these were duplicated across harnesses/claude.rs and commands/run.rs with a keep them in sync comment. CodeRabbit caught the duplication during PR #318 review; this module is the resolution.

Functions§

civil_from_days
Days-since-epoch → (year, month, day). Hinnant 2014.
iso_from_system_time
Format an absolute total_ms (millis since the Unix epoch) as an ISO-8601 UTC string. Split out so callers that already captured a SystemTime (e.g. the driver’s spawn_start_ts) can format it without re-reading the clock.
iso_now
Build an ISO-8601 UTC timestamp suitable for Stamp::ts / the burnSpawnTs enrichment tag. Mirrors new Date().toISOString() in the TS sibling.