![]() |
tempoch-cpp
Header-only C++ wrapper for tempoch
|
tempoch-cpp is a modern, header-only C++17 library for astronomical time primitives. It wraps the Rust-based tempoch through its C FFI layer (tempoch-ffi), exposing UTC, JulianDate, MJD, and Period as idiomatic C++ value types with arithmetic, comparisons, and exception-based error reporting — no manual FFI plumbing required.
| Feature | Description |
|---|---|
**UTC** | Civil date-time struct (year/month/day/hour/min/sec) with nanosecond precision |
**JulianDate** | Strongly-typed Julian Date with arithmetic and UTC conversion |
**MJD** | Strongly-typed Modified Julian Date; interchangeable with JulianDate |
**Period** | Inclusive [start, end] MJD interval with intersection, duration, and iteration helpers |
| Exception hierarchy | All FFI status codes map to typed C++ exceptions |
| Header-only | Drop into any project — no separate compilation step |
tempoch/tempoch.hpp — umbrella include for the full public APItempoch/time.hpp — UTC, JulianDate, MJD typestempoch/period.hpp — Period interval typetempoch/ffi_core.hpp — FFI helpers and exception hierarchyFFI tempoch_status_t codes are translated into typed C++ exceptions:
| Exception | When thrown |
|---|---|
TempochException | Base class for all tempoch errors |
NullPointerError | FFI returned a null handle |
UtcConversionError | Invalid or out-of-range calendar fields |
InvalidPeriodError | start > end or malformed period |
NoIntersectionError | Period intersection on non-overlapping intervals |
cargo) — tempoch-ffi is built automaticallyThen open:
build/docs/doxygen/html/index.html