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
//! Time scales, leap seconds, calendar dates, and the time manager.
//!
//! Pure-Rust port of JEOD's `models/environment/time/`. The crate models the
//! standard astronomical and engineering time scales (TAI, UTC, UT1, TT,
//! TDB, GPS, GMST), the leap-second table that ties UTC to TAI, and the
//! per-simulation user-defined epoch (UDE) and mission-elapsed time (MET)
//! that mission code typically logs against.
//!
//! ## Public surface
//!
//! - [`TimeManager`] and [`TimeScaleId`] — the orchestrator that owns the
//! currently registered time scales and answers conversions between
//! them. Mirrors JEOD's `TimeManager`.
//! - [`SimulationTime`] — the resource the integration loop advances each
//! step; downstream consumers (gravity, ephemeris, atmosphere) read from
//! it rather than tracking their own clocks.
//! - [`DynamicTime`] — the dynamics-frame time state passed through the
//! integrator.
//! - [`LeapSecondTable`] — parser/lookup for JEOD's
//! `models/environment/time/data/Leap_Second.dat`. Required for any
//! simulation that hits a UTC↔TAI conversion.
//! - **Calendar / epoch types**: [`CalendarDate`] and [`UTC_EPOCH_TAI_TJT`]
//! from [`time_utc`], [`UserDefinedEpoch`] from [`time_ude`],
//! [`MissionElapsedTime`] from [`time_met`], [`GpsTimeComponents`] and
//! [`TAI_GPS_OFFSET`] from [`time_gps`], plus the [`epoch`] module.
//! - **Per-pair time converters**: [`time_converter_tai_tdb`],
//! [`time_converter_tai_tt`], and [`time_converter_ut1_gmst`] each port
//! one of JEOD's `TimeConverter_*` classes. GMST in particular drives
//! Earth's body-fixed rotation in `astrodyn_frames`.
//!
//! JEOD source: `models/environment/time/` (and the
//! `models/environment/time/data/` subdirectory for `Leap_Second.dat`). Pure
//! Rust, zero Bevy dependency.
//!
//! ## Example
//!
//! Build a calendar date and round-trip it through the truncated Julian
//! representation that the per-scale converters consume internally:
//!
//! ```
//! use astrodyn_time::time_utc::{calendar_to_tjt, tjt_to_calendar, CalendarDate};
//!
//! let cal = CalendarDate::new(2025, 1, 1, 0, 0, 0.0);
//! let tjt = calendar_to_tjt(&cal);
//! let back = tjt_to_calendar(tjt);
//! assert_eq!(back.year, cal.year);
//! assert_eq!(back.month, cal.month);
//! assert_eq!(back.day, cal.day);
//! ```
pub use *;
pub use *;
pub use LeapSecondTable;
pub use SimulationTime;
pub use DynamicTime;
pub use ;
pub use ;
pub use MissionElapsedTime;
pub use UserDefinedEpoch;
pub use ;