~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/atproto

atproto's primitives in Rust, small and free of I/O

0
0
main
15 lines · 468 B Raw History
use atproto::time::{iso, now_millis};

#[test]
fn writes_times_as_atproto_does() {
    assert_eq!(iso(0), "1970-01-01T00:00:00.000Z");
    assert_eq!(iso(1_793_740_468_123), "2026-11-03T21:14:28.123Z");
    // A leap day, and a time before 1970.
    assert_eq!(iso(951_782_400_000), "2000-02-29T00:00:00.000Z");
    assert_eq!(iso(-1), "1969-12-31T23:59:59.999Z");
}

#[test]
fn knows_now_is_after_this_was_written() {
    assert!(now_millis() > 1_793_740_468_123);
}