Skip to main content

tempoch-cpp

Active

Header-only C++17 wrapper for tempoch: typed Julian Date, MJD, UTC, and Period types for astronomical time in C++.

0 stars
0 forks
C++
AGPL-3.0
Updated today

Why it exists

tempoch-cpp wraps the Rust tempoch-ffi library to provide idiomatic C++ value types for astronomical time. It includes JulianDate, MJD, UTC, and Period with full exception-based error handling and nanosecond precision.

Key Features

  • JulianDate and MJD strongly-typed value wrappers
  • UTC civil date-time with nanosecond precision
  • Period intervals with intersection operations
  • Exception-based error model (typed C++ exceptions)
  • CMake integration with automatic Rust FFI build

Getting Started

// CMakeLists.txt
find_package(tempoch_cpp REQUIRED)
target_link_libraries(myapp PRIVATE tempoch::tempoch_cpp)

// main.cpp
#include <tempoch/tempoch.hpp>
using namespace tempoch;

auto jd = JulianDate::from_utc({2026, 1, 1, 0, 0, 0});
auto mjd = MJD::from_jd(jd);
auto utc = jd.to_utc();

Contributing

We welcome contributions! Here's how you can help:

  • 1 Fork the repository and create your branch from main
  • 2 Make your changes and add tests if applicable
  • 3 Ensure all tests pass with cargo test
  • 4 Submit a pull request with a clear description

License

This project is licensed under the AGPL-3.0 license. See the LICENSE file for details.

Tags

cpp c++17 time astronomy bindings