Repository navigation
Home
Crate: https://crates.io/crates/stkcraft-time API reference: https://docs.rs/stkcraft-time Source: https://github.com/spacelibres/STKCraft-time Releases: https://github.com/spacelibres/STKCraft-time/releases
stkcraft-time is a clean-room Rust implementation of the time-scale model
documented by the NASA Navigation and Ancillary Information Facility (NAIF)
in the SPICE Time Subsystem Required Reading, driven by a Leapseconds
Kernel (LSK).
It does not link CSPICE, does not port CSPICE source code, and does not require an ephemeris kernel. UTC, TAI, TT, TDB/ET, GPS, UT1, TCG, TCB and type-1 spacecraft clocks are computed from published definitions plus the data files the caller supplies.
- Source: https://github.com/spacelibres/STKCraft-time
- API reference: https://docs.rs/stkcraft-time
- crates.io: https://crates.io/crates/stkcraft-time
- Releases: https://github.com/spacelibres/STKCraft-time/releases
From crates.io — https://crates.io/crates/stkcraft-time:
[dependencies]
stkcraft-time = "0.2.1"cargo add stkcraft-timeno_std with alloc:
stkcraft-time = { version = "0.2.1", default-features = false }Minimum supported Rust version: 1.75. The library forbids unsafe.
use stkcraft_time::calendar::Calendar;
use stkcraft_time::convert::{tai_to_et, tai_to_utc, utc_to_tai};
use stkcraft_time::{LeapSecondTable, UtcDateTime};
let lsk = LeapSecondTable::builtin()?; // bundled naif0012.tls
let utc = UtcDateTime::new(2016, 12, 31, 23, 59, 60.5);
let tai = utc_to_tai(&utc, Calendar::Gregorian, &lsk)?;
let et = tai_to_et(tai, &lsk);
let back = tai_to_utc(tai, Calendar::Gregorian, &lsk)?;
assert!((et - 536_500_868.683_929_8).abs() < 1e-9);
assert_eq!(back.second, 60.5);| It is | It is not |
|---|---|
| A time-scale converter driven by explicit kernels | An ephemeris engine |
| Bit-exact against CSPICE for documented cases | A CSPICE binding |
no_std-capable with integer epoch arithmetic |
A wrapper around chrono/time
|
| Explicit about data coverage and model limits | A source of leap-second predictions |
| Verified against CSPICE, ERFA/SOFA and IERS data | A claim of unbounded physical accuracy |
Every number on these pages is either published by NAIF/IAU/IERS and cited, or measured inside this repository with a command you can rerun. Nothing is asserted that the underlying data does not support.
| Page | Contents |
|---|---|
| Time scales | Definitions, exact relations, origins, and which scale to use |
| Leap seconds and the LSK |
TAI - UTC, LSK parsing, policies, day lengths, pre-1972 UTC |
| Kernels | LSK, SCLK and EOP: formats, parsed fields, validation |
| Epoch and duration | Integer+nanosecond representation, checked arithmetic, series |
| UT1 and EOP |
UT1 - UTC, leap-aware interpolation, range semantics, limits |
| Spacecraft clocks | Type-1 ticks, offsets, piecewise-linear mapping, partitions |
| Formatting | Precision, rounding and carry rules, calendars, strftime
|
| TDB models | NAIF ET, the compact approximation, IAU DTDB, and the contract types |
| Verification | Summary of every measured comparison, and what is not claimed |
| Reproducing the comparisons | Commands and raw output for each comparison |
| no_std and embedded | Features, libm, tested targets, MSRV |
| MCP server | Tools, JSON-RPC transport, limits, client setup |
| API map | Modules and the function to call for each task |
| Design and non-goals | The rules the implementation must keep |
| Building and releasing | Toolchains, test matrix, release process |
| Troubleshooting | Error meanings and the usual causes |
The Python and JavaScript/WASM adapters call the same Rust core. See the language support matrix for installation, method inventories, limitations and publication status.
- Latest release: 0.2.1 (crates.io and GitHub Releases).
- See verification and the repository for current test coverage.
- CI runs on Linux, macOS and Windows, plus MSRV 1.75,
wasm32-unknown-unknownandthumbv7em-none-eabi. - License: MIT.
Use the issue tracker. Include the crate version, the enabled features, the kernel files in use (LSK/SCLK/EOP names and dates), and the exact input that failed.
