Expand description
Typed astronomical time primitives.
The central type is Time<S, F> (default F = J2000s), where S is a Scale
marker (TT, TAI, UTC, UT1, TDB, TCG, TCB) and F is a TimeFormat
tag (JD, MJD, J2000s, Unix, GPS).
tempoch makes a few explicit modeling decisions:
-
Time<S, F>is an instant on a scale-specific axis;Fonly types external views (raw(), conversion targets), not a second storage layout. -
Time arithmetic follows affine rules: instant minus instant yields a duration; shifting an instant by a duration yields another instant.
-
Internal storage is always 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 alternate stored encodings. -
UTCkeeps special civil semantics: it is stored as a continuous instant and interpreted through the active UTC-TAI table when civil labels are needed. -
Time::newbuilds from a raw scalar whenFisInfallibleFormatForScaleforS(NaN panics; ±∞ allowed at rest). POSIXUnixinstants still useTime::try_new/Time::try_new_withbecause decoding depends on leap-second tables. -
Time::try_new/Time::try_new_withsurface domain decode failures only (UTC policy, leap seconds, …); callers must not pass NaN. -
Unified targets:
Time::to,Time::try_to,Time::to_with. Prefertry_toorto_withforUnixso positive leap-second instants are rejected when they are not representable as POSIX. -
Time::to_j2000s,Time::reinterpret, and aliases such ascrate::JulianDate. -
JulianDate,ModifiedJulianDate,UnixTime, andGpsTimeimplementIntointo default-taggedTime<S>/Time<UTC>/Time<TAI>, so APIs such asPeriod::try_newaccept encoded endpoints without spellingTime::to_j2000s.J2000Seconds<S>is alreadyTime<S>; no conversion needed.
See constats for epoch Time helpers, day/second scratch constants, and offsets.
§Module map
foundation: shared sealed traits, typed constants, and error types.model:Time, scale markers, and conversion targets.format: external format markers and format conversion traits.encoding: crate-local JD/MJD/J2000/Unix arithmetic helpers.earth: ΔT, EOP, andTimeContextEarth-rotation policy.data: runtime access to bundled and optionally refreshed time-data tables.period: interval and period-list algebra.features: optional serde/tagged/time-instant integration helpers.
Reference modules:
earth::delta_t: piecewise ΔT (TT - UT1) model and modern tabular segment.earth::eop: public EOP sampling API over bundled IERS series.earth::context: immutable time-data snapshot plus conversion policy.
Re-exports§
pub use earth::eop;pub use foundation::constats;pub use foundation::error;pub use data::status::assert_fresh as assert_time_data_fresh;pub use data::status::time_data_status;pub use data::status::ActiveTimeDataSource;pub use data::status::DataHorizons;pub use data::status::FreshnessError;pub use data::status::TimeDataStatus;pub use earth::context::TimeContext;pub use earth::delta_t::delta_t_seconds;pub use earth::delta_t::delta_t_seconds_extrapolated;pub use earth::delta_t::DELTA_T_PREDICTION_HORIZON_MJD;pub use earth::eop::eop_end;pub use earth::eop::eop_observed_end;pub use earth::eop::eop_start;pub use features::TimeInstant;pub use format::FormatForScale;pub use format::FormatOptions;pub use format::FormatPrecision;pub use format::GnssWeek;pub use format::GnssWeekScale;pub use format::GpsTime;pub use format::InfallibleFormatForScale;pub use format::J2000Seconds;pub use format::J2000s;pub use format::JulianDate;pub use format::ModifiedJulianDate;pub use format::TimeFormat;pub use format::Unix;pub use format::UnixTime;pub use format::GPS;pub use format::JD;pub use format::MJD;pub use foundation::constats::gps_epoch_jd_tai;pub use foundation::constats::gps_epoch_jd_utc;pub use foundation::constats::gps_epoch_tai;pub use foundation::constats::iau_time_epoch_t0_jd;pub use foundation::constats::j2000_jd_tt;pub use foundation::constats::tdb_tt_model_high_accuracy_end_jd;pub use foundation::constats::tdb_tt_model_high_accuracy_start_jd;pub use foundation::constats::unix_epoch_jd;pub use foundation::constats::unix_epoch_mjd;pub use foundation::constats::utc_defined_from_mjd;pub use foundation::constats::GPS_EPOCH_JD_UTC_DAY;pub use foundation::constats::GPS_EPOCH_TAI_MINUS_UTC;pub use foundation::constats::IAU_TIME_EPOCH_T0_JD_DAY;pub use foundation::constats::J2000_JD_TT_DAY;pub use foundation::constats::TDB_TT_MODEL_HIGH_ACCURACY_END_JD_DAY;pub use foundation::constats::TDB_TT_MODEL_HIGH_ACCURACY_START_JD_DAY;pub use foundation::constats::TT_MINUS_TAI;pub use foundation::constats::UNIX_EPOCH_JD_DAY;pub use foundation::constats::UTC_DEFINED_FROM_MJD_DAY;pub use foundation::duration::DurationError;pub use foundation::duration::ExactDuration;pub use foundation::duration::NANOS_PER_SECOND;pub use foundation::error::ConversionError;pub use foundation::error::TimeDataError;pub use model::scale::ContinuousScale;pub use model::scale::CoordinateScale;pub use model::scale::Scale;pub use model::scale::BDT;pub use model::scale::ET;pub use model::scale::GPST;pub use model::scale::GST;pub use model::scale::QZSST;pub use model::scale::TAI;pub use model::scale::TCB;pub use model::scale::TCG;pub use model::scale::TDB;pub use model::scale::TT;pub use model::scale::UT1;pub use model::scale::UTC;pub use model::target::ContextConversionTarget;pub use model::target::ConversionTarget;pub use model::target::InfallibleConversionTarget;pub use model::time::Time;pub use period::complement_within;pub use period::series::TimeSeries;pub use period::series::TimeSeriesError;pub use period::Interval;pub use period::InvalidIntervalError;pub use period::Period;pub use period::PeriodListError;
Modules§
- data
- Runtime access to bundled and optionally refreshed time-data tables.
- earth
- Earth-orientation and Earth-rotation conversion policy.
- features
- Optional or higher-level feature modules layered on top of the core time model.
- format
- Typed external formats for
crate::Time. - foundation
- Shared crate foundations used by every domain layer.
- model
- Core time model: instants, scales, and conversion targets.
- period
- Generic periods and interval-list operations.