From 8049714cdbb1470b09d27b9a8e1f01b4010a383e Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 28 Oct 2025 20:17:35 +0000 Subject: [PATCH] rename anoia.tai64.to-utc as to-unix it's a far more accurate name for somethingthat return non-leap seconds since 1-1-1970 --- pkgs/anoia/tai64.fnl | 6 +++--- pkgs/logshippers/victorialogsend.fnl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/anoia/tai64.fnl b/pkgs/anoia/tai64.fnl index 74d2045..8f40e93 100644 --- a/pkgs/anoia/tai64.fnl +++ b/pkgs/anoia/tai64.fnl @@ -64,7 +64,7 @@ {:s sec :n nano}) nil)) -(fn to-utc [tai] +(fn to-unix [tai] (values (- tai.s (leap-seconds tai.s)) tai.n)) (define-tests @@ -72,8 +72,8 @@ (from-timestamp "@4000000068e2f0d3257dc09b") {:s 1759703251 :n 628998299}) - (let [(s n) (to-utc (from-timestamp "@4000000068e2f0d3257dc09b"))] + (let [(s n) (to-unix (from-timestamp "@4000000068e2f0d3257dc09b"))] (expect= [s n] [1759703214 628998299])) ) -{ : from-timestamp : to-utc } +{ : from-timestamp : to-unix } diff --git a/pkgs/logshippers/victorialogsend.fnl b/pkgs/logshippers/victorialogsend.fnl index b089556..5b72e59 100644 --- a/pkgs/logshippers/victorialogsend.fnl +++ b/pkgs/logshippers/victorialogsend.fnl @@ -48,7 +48,7 @@ Host: %s\ path host authstr))) (fn format-timestamp-rfc3339 [timestamp prec] - (let [(sec nano) (-> timestamp tai64.from-timestamp tai64.to-utc) + (let [(sec nano) (-> timestamp tai64.from-timestamp tai64.to-unix) subsec (string.sub (string.format "%09d" nano) 1 prec)] (.. (os.date "!%FT%T" sec) "." subsec