1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Astronomical time scales.
//!
//! Provides implementations of the eight primary time scales used in astronomical
//! calculations: UTC, TAI, TT, UT1, GPS, TDB, TCB, and TCG.
//!
//! # Time Scale Overview
//!
//! | Scale | Description | TAI Relationship |
//! |-------|-------------|------------------|
//! | TAI | International Atomic Time | Reference |
//! | UTC | Coordinated Universal Time | TAI - leap seconds |
//! | TT | Terrestrial Time | TAI + 32.184s |
//! | UT1 | Earth rotation time | Requires EOP data |
//! | GPS | GPS satellite time | TAI - 19s |
//! | TCG | Geocentric Coordinate Time | Linear scale from TT |
//! | TDB | Barycentric Dynamical Time | TT + periodic terms |
//! | TCB | Barycentric Coordinate Time | Linear scale from TDB |
//!
//! # Usage
//!
//! Each time scale is a newtype wrapping a Julian Date. Create instances via
//! `from_julian_date` or `*_from_calendar` helper functions:
//!
//! ```
//! use celestial_time::{JulianDate, TAI, TT, UTC};
//! use celestial_time::scales::{tai_from_calendar, tt_from_calendar};
//!
//! // From Julian Date
//! let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));
//!
//! // From calendar components
//! let tt = tt_from_calendar(2000, 1, 1, 12, 0, 0.0);
//! ```
//!
//! # Conversions
//!
//! Convert between scales using traits from the [`conversions`] submodule:
//!
//! ```
//! use celestial_time::{JulianDate, GPS, TAI, TT};
//! use celestial_time::scales::conversions::{ToTAI, ToTT, ToGPS};
//!
//! let tai = TAI::from_julian_date(JulianDate::new(2451545.0, 0.0));
//! let tt = tai.to_tt().unwrap();
//! let gps = tai.to_gps().unwrap();
//! ```
//!
//! Some conversions chain through intermediate scales internally. For example,
//! GPS to TT converts GPS -> TAI -> TT.
//!
//! # Precision
//!
//! All time scales use split Julian Date storage (jd1, jd2) to preserve
//! nanosecond precision. When adding offsets, the offset is applied to
//! the smaller-magnitude component.
pub use gps_from_calendar;
pub use GPS;
pub use tai_from_calendar;
pub use TAI;
pub use tcb_from_calendar;
pub use TCB;
pub use tcg_from_calendar;
pub use TCG;
pub use tdb_from_calendar;
pub use TDB;
pub use tt_from_calendar;
pub use TT;
pub use ut1_from_calendar;
pub use UT1;
pub use utc_from_calendar;
pub use UTC;
pub use ;