Skip to main content

tempoch

Active

Typed astronomical time primitives for Rust: Julian Date, MJD, TAI, GPS, UT, and UTC conversions with automatic ΔT handling.

0 stars
0 forks
Rust
AGPL-3.0
Updated today

Why it exists

tempoch provides strongly typed time instants parameterized by time-scale markers (JD, MJD, TT, UT, TAI, GPS, UnixTime, …) so you can never accidentally mix incompatible time representations. It powers the time layer used across all Siderust crates.

Key Features

  • Generic Time<S> instants by time-scale
  • Built-in UTC ↔ TT/MJD conversion via chrono
  • Automatic ΔT = TT − UT handling
  • Period intervals with intersection / complement
  • No-std compatible

Getting Started

# Add to your Cargo.toml
[dependencies]
tempoch = "0.3"

# Convert UTC to Julian Date
use chrono::Utc;
use tempoch::{JulianDate, MJD, Time};

let now_jd = JulianDate::from_utc(Utc::now());
let now_mjd: Time<MJD> = now_jd.to::<MJD>();
println!("JD(TT): {now_jd}");
println!("MJD(TT): {now_mjd}");

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

time astronomy julian-date utc rust