Expand description
Pure-arithmetic datetime manipulation (epoch-based, no system clock). DateTime support for CJC.
Design decisions:
- Epoch millis (i64), UTC only — deterministic, no timezone ambiguity
datetime_now()is NONDET (uses system clock)- All other operations are pure arithmetic on epoch millis
- Leap year handling for year/month/day extraction
Functions§
- datetime_
add_ millis - Add milliseconds to a datetime.
- datetime_
day - Extract the day of month (1-31) from epoch millis.
- datetime_
diff - Difference between two datetimes in milliseconds.
- datetime_
format - Format a datetime as ISO 8601 UTC string:
YYYY-MM-DDTHH:MM:SSZ - datetime_
from_ epoch - Create a datetime from epoch milliseconds (identity, but validates type).
- datetime_
from_ parts - Create a datetime from year, month, day, hour, minute, second components. All components are 1-based for month/day.
- datetime_
hour - Extract the hour (0-23) from epoch millis.
- datetime_
minute - Extract the minute (0-59) from epoch millis.
- datetime_
month - Extract the month (1-12) from epoch millis.
- datetime_
now - Returns current UTC time as epoch milliseconds. This is NONDET — the only nondeterministic datetime operation.
- datetime_
second - Extract the second (0-59) from epoch millis.
- datetime_
year - Extract the year from epoch millis.
- days_
in_ month - Return the number of days in the given month (1-12) of the given year.