Skip to main content

Crate stkcraft_time

Crate stkcraft_time 

Source
Expand description

NAIF/SPICE-aligned astronomical time scales.

stkcraft-time implements the time-scale model described in the NAIF SPICE Time Subsystem Required Reading. Kernel decimal arithmetic follows NAIF N0067 NPARSD; see ATTRIBUTION.md. The leap-second data is read from a NAIF Leapseconds Kernel; no leap second is hard-coded in the conversion logic.

§Scales

  • Calendar selects Gregorian, Julian or Mixed calendar arithmetic.
  • Epoch is the canonical internal value: continuous TAI seconds plus nanoseconds since 2000-01-01T00:00:00 TAI.
  • UtcDateTime is the civil UTC representation, including 23:59:60.x on positive-leap-second days.
  • Duration is an exact signed duration with nanosecond resolution.
  • TimeSeries iterates uniformly spaced epochs.
  • convert provides UTC, TAI, TT, TDB/ET, GPS and UT1 conversions.
  • coord provides the IAU coordinate scales TCG and TCB.
  • dtdb provides the IAU Fairhead-Bretagnon TDB model.
  • eop holds the IERS Earth Orientation Parameters that UT1 requires.
  • contract separates the default NAIF ET integration contract from explicitly selected scientific TDB and observer-dependent models.

§Kernel selection

Every UTC conversion is a pure function of the leap-second kernel that is loaded. There is no globally implied kernel and no leap second is hard-coded in the conversion logic. Load the kernel you intend to use with LeapSecondTable::from_lsk; the bundled LeapSecondTable::builtin is only a snapshot of naif0012.tls. Two kernels with different DELTET/DELTA_AT lists produce different TAI - UTC after the first differing date. LeapSecondTable::coverage reports which dates a kernel actually covers.

§Accuracy

Internal epoch arithmetic is integer-based, and the nanosecond field is exactly that: a step of the internal representation, not a claim of nanosecond accuracy. Real accuracy is bounded by the model and the data:

  • The leap-second kernel supplies whole-second steps; there is no sub-second leap data to be had.
  • The TT/TDB model (TDB - TT = K * sin(E)) is the NAIF model, whose stated accuracy is about 30 microseconds.
  • ET is an f64 by definition, exactly as in SPICE.

Agreement with CSPICE is a match against a reference engine, not a physical truth claim.

§Leap-second policy

Leap seconds are data, not code. LeapSecondTable follows the LSK it was built from. The default LeapSecondPolicy::TableDriven keeps the last entry in force; a caller may select LeapSecondPolicy::FrozenAfter to model an explicit assumption. The crate never infers a policy from a date.

Re-exports§

pub use bdt::Bdt;
pub use calendar::Calendar;
pub use duration::Duration;
pub use eop::EopSample;
pub use eop::EopSeries;
pub use eop::EopTable;
pub use epoch::Epoch;
pub use epoch::UtcDateTime;
pub use error::TimeError;
pub use kernel_date::parse_kernel_date;
pub use kernel_date::KernelDate;
pub use leap::LeapEntry;
pub use leap::LeapSecondPolicy;
pub use leap::LeapSecondSource;
pub use leap::LeapSecondTable;
pub use sclk::SclkKernel;
pub use sclk::SclkTimeSystem;
pub use series::TimeSeries;
pub use timescale::TimeScale;

Modules§

bdt
Nominal BeiDou Time (BDT), independent of the NAIF time-scale model.
calendar
Calendar arithmetic and Julian Date conversion.
contract
Explicit contracts for SPICE-compatible geometry and scientific time.
convert
Conversion routines between the supported time scales.
coord
Coordinate time scales: TCG and TCB.
dtdb
IAU TDB model: the Fairhead & Bretagnon (1990) series.
duration
Exact signed durations with nanosecond resolution.
eop
IERS Earth Orientation Parameters (EOP) and UT1.
epoch
Canonical epoch type and the civil UTC representation.
error
Error types shared by all modules.
format
Calendar string formatting.
kernel_date
N0067 date literals from SPICE text kernels.
leap
Leap-second table and the NAIF DELTET constants.
lsk
Parser for the subset of NAIF text kernels needed by the time model.
mcp
Minimal Model Context Protocol (MCP) server over stdio.
sclk
Spacecraft clock (SCLK) kernels, type 1.
series
A uniform time series between two epochs.
tdb
Compact two-term approximation to geocentric TDB.
timescale
Time-scale identifiers.
wgc_gps
Explicit WebGeocalc GPS week/TOW compatibility paths.