Repository navigation
no_std and Embedded
stone edited this page Nov 13, 2026
·
10 revisions
| Feature | Default | Effect |
|---|---|---|
std |
yes |
impl std::error::Error, the CLI binaries, file loading helpers |
mcp |
no | builds stkcraft-mcp; implies std and serde_json
|
| (none) | — |
no_std + alloc; the library is available, binaries are skipped |
# no_std with alloc
stkcraft-time = { version = "0.2.1", default-features = false }-
#![forbid(unsafe_code)]applies to every build. There is nounsafeto audit. - Epoch and duration arithmetic is integer-based (
i64seconds plus nanoseconds, withi128totals in checked paths). No floating-point accumulation is used for time arithmetic. - Floating-point math goes through
libm:sin,cos,floor,round,abs,to_radians. Nostd-only float methods are used, includingpowi. - All parsing (
LSK,SCLK,EOPtext) works on&strandalloctypes. File I/O is the caller's responsibility. - Formatting uses
alloc::string::String; there is nostd::ioin the library.
- Reading files for you (
LeapSecondTable::from_lsktakes text; loading it from disk is your code). - The binaries:
sclk-check,ut1-check,tdb-compare,wgc-compare. - The MCP server.
| Target | Status |
|---|---|
x86_64 / aarch64 (host) |
full test suite |
wasm32-unknown-unknown |
cargo build --no-default-features |
thumbv7em-none-eabi |
cargo build --no-default-features |
| Rust 1.75 (MSRV) | cargo check --all-targets --features mcp |
cargo build --no-default-features
cargo build --no-default-features --target wasm32-unknown-unknown
cargo build --no-default-features --target thumbv7em-none-eabi
cargo +1.75.0 check --all-targets --features mcp- The IAU DTDB table is 787
[f64; 3]rows (about 18 KiB of constants) and is always compiled in. It is the largest static table in the crate. - The bundled
naif0012.tlsis included as text and parsed at run time byLeapSecondTable::builtin(). On a resource-constrained target, parse it once at start-up and keep theLeapSecondTable.
use stkcraft_time::calendar::Calendar;
use stkcraft_time::convert::utc_to_tai;
use stkcraft_time::{LeapSecondTable, UtcDateTime};
static LSK_TEXT: &str = include_str!("../kernels/naif0012.tls");
let lsk = LeapSecondTable::from_lsk(LSK_TEXT)?; // once, at start-up
let tai = utc_to_tai(&utc, Calendar::Gregorian, &lsk)?; // per sampleThe conversion itself allocates nothing beyond the parsed table.
