commit 947a1c1373cd834513356dbb32b20c3d425af45c parent 59eea64985d3d0b41e0860b13378ad22ecd0158b Author: Daniel Barlow <dan@telent.net> Date: Mon, 6 Oct 2025 22:23:14 +0100 return utc as (values seconds nanos) fractional seconds is just inviting too much fun with floating point error Diffstat:
| M | pkgs/anoia/tai64.fnl | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pkgs/anoia/tai64.fnl b/pkgs/anoia/tai64.fnl @@ -65,14 +65,15 @@ nil)) (fn to-utc [tai] - (+ (- tai.s (leap-seconds tai.s)) (/ tai.n 1e9))) + (values (- tai.s (leap-seconds tai.s)) tai.n)) (define-tests (expect= (from-timestamp "@4000000068e2f0d3257dc09b") {:s 1759703251 :n 628998299}) - (expect= (to-utc (from-timestamp "@4000000068e2f0d3257dc09b")) - 1759703214.628998299)) + (let [(s n) (to-utc (from-timestamp "@4000000068e2f0d3257dc09b"))] + (expect= [s n] [1759703214 628998299])) + ) { : from-timestamp : to-utc }