Skip to main content

Crate satellite_datetime

Crate satellite_datetime 

Source
Expand description

Experimental timescales for spacecraft, the Moon, and the solar system.

Status: 0.1 work-in-progress. APIs may break. Not flight-qualified. Lunar TCL is origin-only (no IAU periodic series). Time zones are a seven-zone subset, not the IANA tzdb. Coordinated Lunar Time (LTC) is provisional. UT1/DUT1 is a pinned IERS C04 table (not CIP/CIO polar motion).

An instant is not a calendar. The core stores TAI nanoseconds since 1958-01-01 00:00:00 TAI. UTC leap seconds, DST, sols, and lunar clocks are projections of that value. There is no now(); inject a clock.

Cost model (earth feature): TAI arithmetic is the hot core. Reconstructing civil UTC from an arbitrary Instant (to_utc) is a convenience search. Same-day telemetry should pin a UtcDay and use dut1_at / era_at_utc.

use satellite_datetime::{Duration, Instant};

let t = Instant::TAI_EPOCH
    .checked_add(Duration::from_seconds(1))
    .unwrap();
assert_eq!(t.as_tai_nanos(), 1_000_000_000);

Enable --no-default-features for the satellite (no_std, no allocator) profile.

API docs: https://docs.rs/satellite-datetime. Locally: cargo doc --open.

Re-exports§

pub use duration::Duration;
pub use error::Error;
pub use error::Result;
pub use instant::Instant;
pub use julian::civil_from_unix_days;
pub use julian::unix_days_from_civil;
pub use julian::JulianDate;
pub use scale::Bdt;
pub use scale::Gps;
pub use scale::Gst;
pub use scale::Ltc;
pub use scale::Reading;
pub use scale::Scale;
pub use scale::Tai;
pub use scale::Tcb;
pub use scale::Tcg;
pub use scale::Tcl;
pub use scale::Tdb;
pub use scale::Tt;
pub use earth::dut1_at;earth
pub use earth::era_at_utc;earth
pub use earth::format_rfc3339;earth
pub use earth::gmst_mean_at_utc;earth
pub use earth::julian_ut1_at;earth
pub use earth::parse_rfc3339;earth
pub use earth::utc_mjd;earth
pub use earth::CivilUtc;earth
pub use earth::UtcContext;earth
pub use earth::UtcDay;earth

Modules§

bodiesbodies
Generic solar-system bodies: IAU WGCCRE prime-meridian rotation (sidereal).
ccsdsccsds
CCSDS 301.0-B-4 time codes. Recommended epoch: 1958-01-01 TAI (no leap seconds).
duration
SI durations. Never a calendar day, never a leap second.
earthearth
Earth civil time: leap seconds, Gregorian, ISO 8601, POSIX Unix, DUT1, ERA.
error
Errors that never panic on library paths.
gnssgnss
GNSS system times as uniform offsets from TAI.
instant
Physical instants stored as TAI nanoseconds since 1958-01-01 00:00:00 TAI.
julian
Two-part Julian dates and day counts.
lunarlunar
Lunar Coordinate Time (IAU 2024 TCL) and provisional Coordinated Lunar Time.
marsmars
Mars Sol Date and Coordinated Mars Time (Allison & McEwen / NASA GISS Mars24).
scale
Named timescales. Phantom types prevent mixing readings.
tztz
IANA-compatible time zones with DST gaps and overlaps.

Constants§

BDT_MINUS_TAI
BDT − TAI = −33 s.
GPS_MINUS_TAI
GPS − TAI = −19 s.
IAU_1977_JD
1977-01-01 00:00:00 TAI = JD 2443144.5. IAU origin of TT/TCG/TCB relations.
J2000_JD
J2000.0 TT = 2000-01-01 12:00:00 TT = JD 2451545.0.
LTC_DEFINITION_STATUS
IAU 2024: at the defining event, TCL = TCB = 1977-01-01 00:00:32.184. That TCB reading is TT at the 1977 TAI midnight plus 32.184 s = TAI 1977 + 32.184 s.
LUNAR_SURFACE_MINUS_TT_PER_DAY
Mean lunar surface proper time minus TT (Ashby & Patla 2024 class result). Clocks on the Moon run faster than TT by about 56.02 µs per terrestrial day.
L_B
IAU 2006 L_B: TCB − TDB rate.
L_G
IAU 2000 L_G: TCG − TT rate.
NS_PER_DAY
Nanoseconds in a 86400-second nominal day.
NS_PER_SEC
Nanoseconds in one SI second.
TAI_1977_NS
TAI nanoseconds from 1958-01-01 to 1977-01-01 00:00:00 TAI. 19 y including leap days 1960,1964,1968,1972,1976 = 19*365+5 = 6940 days.
TAI_EPOCH_JD
Julian Date of 1958-01-01 00:00:00 (TAI epoch, CCSDS).
TAI_EPOCH_MJD
Modified Julian Date of the TAI epoch.
TAI_EPOCH_UNIX_DAYS
Unix day number of the TAI epoch (days since 1970-01-01).