Skip to main content

Crate tempoch_core

Crate tempoch_core 

Source
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, and GPS are conversion targets, not independent storage models.
  • UTC keeps 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
  • UTC exposes both raw instant-axis helpers and civil/transport APIs (chrono, POSIX)
  • TAI exposes GPS transport helpers
  • unified conversion targets are available through time.to::<Target>(), time.try_to::<Target>(), and time.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.all series.
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.
TimeContext
Explicit, immutable context for conversions that need one.
UT1
Universal Time 1 — Earth-rotation time axis.
UTC
Coordinated Universal Time.

Enums§

InvalidIntervalError
Error constructing an Interval with invalid bounds.
PeriodListError
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§

ContextConversionTarget
Unified context-backed conversion target for Time<S>::to_with::<T>(&ctx).
ContinuousScale
Witness that a scale is both coordinate-bearing and physically continuous.
ConversionTarget
Unified conversion target for Time<S>::try_to::<T>().
CoordinateScale
Witness that a scale is continuous and supports direct arithmetic. UTC deliberately does not implement this: it has raw-axis accessors through CoordinateScale, but its civil interpretation remains leap-second-aware and table-driven.
InfallibleConversionTarget
Unified infallible conversion target for Time<S>::to::<T>().
Scale
Marker trait for a scientifically distinct time scale.

Functions§

complement_within
Gaps inside outer that are not covered by any interval in periods.
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§

InvalidPeriodError
Backward-compatible alias for period construction validation errors.
Period
Typed time period on a given scale.