Expand description
Typed astronomical time primitives.
The central type is Time<S>, where S is a Scale marker
(TT, TAI, UTC, UT1, TDB, TCG, TCB).
tempoch makes a few explicit modeling decisions:
Time<S>is an instant on a scale-specific axis, not a bare scalar.- Time arithmetic follows affine rules: instant minus instant yields a duration; shifting an instant by a duration yields another instant.
- Internal storage is a compensated
(hi, lo)pair of J2000-based seconds so large epoch values can retain small corrections and sub-second detail. JD,MJD,J2000s,Unix, andGPSare conversion targets, not independent storage models.UTCkeeps special civil semantics: it is stored as a continuous instant and interpreted through the active UTC-TAI table when civil labels are needed.
The old format-generic storage model has been replaced with explicit constructors and accessors:
- built-in coordinate scales expose J2000-second, JD, and MJD constructors/accessors
UTCexposes both raw instant-axis helpers and civil/transport APIs (chrono, POSIX)TAIexposes GPS transport helpers- unified conversion targets are available through
time.to::<Target>(),time.try_to::<Target>(), andtime.to_with::<Target>(&ctx)
See constats for typed epoch and offset constants.
Re-exports§
pub use constats::GPS_EPOCH_JD_TAI;pub use constats::GPS_EPOCH_JD_UTC;pub use constats::GPS_EPOCH_TAI_MINUS_UTC;pub use constats::UTC_DEFINED_FROM_MJD;pub use error::ConversionError;pub use error::TimeDataError;pub use ext::TimeInstant;pub use representation::EncodedTime;pub use representation::GpsTime;pub use representation::InfallibleRepresentationForScale;pub use representation::J2000Seconds;pub use representation::J2000s;pub use representation::JulianDate;pub use representation::ModifiedJulianDate;pub use representation::RepresentationForScale;pub use representation::TimeRepresentation;pub use representation::Unix;pub use representation::UnixTime;pub use representation::GPS;pub use representation::J2000_TT;pub use representation::JD;pub use representation::JULIAN_YEAR_DAYS;pub use representation::MJD;pub use scalar::scalar_add_days;pub use scalar::scalar_difference_in_days;pub use scalar::time_tt_from_scalar;pub use scalar::time_tt_to_scalar;pub use scalar::ScaleKind;
Modules§
- constats
- Typed epoch and offset constants.
- eop
- Daily IERS Earth Orientation Parameters from the compiled
finals2000A.allseries. - error
- ext
- Extension traits for time types.
- representation
- Typed encoded representations of
crate::Time. - scalar
- Scalar-value adapter for time scale dispatch.
Structs§
- Interval
- Half-open time interval
[start, end). - TAI
- International Atomic Time. Continuous SI-second clock.
- TCB
- Barycentric Coordinate Time (IAU 2006 B3). Linear relation to TDB.
- TCG
- Geocentric Coordinate Time (IAU 2000 B1.9). Linear rate difference to TT.
- TDB
- Barycentric Dynamical Time.
- TT
- Terrestrial Time. The dynamical reference scale in this crate.
- Time
- A point in time on scale
S. - Time
Context - Explicit, immutable context for conversions that need one.
- UT1
- Universal Time 1 — Earth-rotation time axis.
- UTC
- Coordinated Universal Time.
Enums§
- Invalid
Interval Error - Error constructing an
Intervalwith invalid bounds. - Period
List Error - Invariants on a period list.
Constants§
- DELTA_
T_ PREDICTION_ HORIZON_ MJD - MJD of the last compiled ΔT prediction point.
- EOP_
END_ MJD - EOP_
OBSERVED_ END_ MJD - EOP_
START_ MJD - MODERN_
DELTA_ T_ OBSERVED_ END_ MJD
Traits§
- Context
Conversion Target - Unified context-backed conversion target for
Time<S>::to_with::<T>(&ctx). - Continuous
Scale - Witness that a scale is both coordinate-bearing and physically continuous.
- Conversion
Target - Unified conversion target for
Time<S>::try_to::<T>(). - Coordinate
Scale - Witness that a scale is continuous and supports direct arithmetic.
UTCdeliberately does not implement this: it has raw-axis accessors throughCoordinateScale, but its civil interpretation remains leap-second-aware and table-driven. - Infallible
Conversion Target - Unified infallible conversion target for
Time<S>::to::<T>(). - Scale
- Marker trait for a scientifically distinct time scale.
Functions§
- complement_
within - Gaps inside
outerthat are not covered by any interval inperiods. - delta_
t_ seconds - ΔT = TT − UT1, in seconds, for a Julian Day on the UT1 axis.
- delta_
t_ seconds_ extrapolated - ΔT = TT − UT1, in seconds, with quadratic tail-fit extrapolation beyond the last published prediction point.
Type Aliases§
- Invalid
Period Error - Backward-compatible alias for period construction validation errors.
- Period
- Typed time period on a given scale.