No description
Find a file
randogoth 07ae2a3b20 init
2026-09-13 00:11:23 +03:00
src init 2026-09-13 00:11:23 +03:00
target init 2026-09-13 00:11:23 +03:00
Cargo.lock init 2026-09-13 00:11:23 +03:00
Cargo.toml init 2026-09-13 00:11:23 +03:00
README.md init 2026-09-13 00:11:23 +03:00

td36

Time-delta identifiers: a timestamp is stored as the base36 encoding of its offset from a chosen epoch, so ids stay short, sortable and monotonically increasing.

use td36::{Td36Epoch, Td36Precision};

let epoch = Td36Epoch::new(1_700_000_000, Td36Precision::Seconds);
let id = epoch.encode(1_700_000_123).unwrap();
assert_eq!(epoch.decode_id(&id).unwrap(), 1_700_000_123);

Td36Epoch::encode_epoch_marker / decode_epoch_marker round-trip the epoch itself, so a stream of ids can carry the epoch it is relative to.

No dependencies. cargo test covers epoch round-tripping and the before-epoch guard.