Skip to main content

Module interop

Module interop 

Source
Expand description

Reusable PyO3 interoperability for Python datetimes and tempoch UTC values.

Python inputs must be timezone-aware. Fixed offsets are normalized to UTC, and all scientific time handling is delegated to tempoch.

let instant = tempoch_py::interop::datetime_to_time(value)?;
tempoch_py::interop::time_to_datetime(value.py(), instant)

Functionsยง

datetime_to_time
Convert a timezone-aware Python datetime.datetime to canonical tempoch UTC.
datetime_to_time_with
Convert with an explicit tempoch TimeContext.
period_to_datetimes
Convert a canonical tempoch UTC period to Python start/end datetimes.
period_to_datetimes_with
Convert a UTC period with an explicit tempoch TimeContext.
time_to_datetime
Convert canonical tempoch UTC to a timezone-aware UTC Python datetime.
time_to_datetime_with
Convert to a Python datetime with an explicit tempoch TimeContext.