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
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user