Skip to main content

Module temporal

Module temporal 

Source
Expand description

Calendar arithmetic (Howard Hinnant’s algorithms) and the clock.

Functions§

clear_fixed_clock
Restore the system clock.
date_add_span
Add a calendar span (months, then days) to a date held as days since 1970-01-01 — the civil Date + Span every tier computes: months clamp at the end of the month and respect leap years (Jan 31 + 1 month = Feb 28/29), then whole days roll over. Month and day arithmetic wraps at i32, as Int span arithmetic does everywhere. Date - Span is this with both parts negated.
days_in_month
The number of days in a given month (1-indexed).
fixed_clock
The injected fixed clock (days, nanos), or None when the system clock is live. The spatial fabric reads this so a now/today tile produces the SAME instant the VM does — a combinational circuit has no wall clock, so a deterministic differential requires an injected one (tests set it around both runs).
moment_add_span
Add a calendar span (months then days) to a SmoothUTC instant — the civil (wall-clock) operation: months clamp at end-of-month and respect leap years, the time-of-day rides along untouched. Distinct from adding a physical Duration (which is just nanosecond arithmetic). Delegates to the same base::temporal::add_span the AOT mirror uses, so the tiers cannot diverge.
now
The now builtin identifier.
set_fixed_clock
Pin today/now to a fixed instant (tests).
today
The today builtin identifier.