commit cac825801f84df94904fc883361d53ea0291f561 parent 49392aadbbb511c7c463e29fff7d6685f098dd6e Author: Natasha Kerensikova <natgh@instinctive.eu> Date: Mon, 11 May 2026 18:12:03 +0000 Time primitives are shared Diffstat:
| M | src/common.scm | | | 15 | +++++++++++++++ |
| M | src/iens.scm | | | 15 | --------------- |
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/common.scm b/src/common.scm @@ -29,6 +29,21 @@ (else (loop (cdr items)))))) #f))) +(define (time->rfc-3339 time) + (let ((time-str (time->string time "%FT%T%z"))) + (assert (= 24 (string-length time-str))) + (if (equal? "0000" (substring time-str 20)) + (string-append (substring time-str 0 19) "Z") + (string-append (substring time-str 0 22) + ":" + (substring time-str 22))))) + +(define (rfc-3339-local seconds) + (time->rfc-3339 (seconds->local-time seconds))) +(define (rfc-3339-utc seconds) + (time->rfc-3339 (seconds->utc-time seconds))) +(define rfc-3339 rfc-3339-local) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Database Creation/Migration diff --git a/src/iens.scm b/src/iens.scm @@ -43,21 +43,6 @@ (and (>= ls lms) (substring=? s maybe-suffix (- ls lms))))) -(define (time->rfc-3339 time) - (let ((time-str (time->string time "%FT%T%z"))) - (assert (= 24 (string-length time-str))) - (if (equal? "0000" (substring time-str 20)) - (string-append (substring time-str 0 19) "Z") - (string-append (substring time-str 0 22) - ":" - (substring time-str 22))))) - -(define (rfc-3339-local seconds) - (time->rfc-3339 (seconds->local-time seconds))) -(define (rfc-3339-utc seconds) - (time->rfc-3339 (seconds->utc-time seconds))) -(define rfc-3339 rfc-3339-local) - (define (terminate-line line) (let ((l (string-length line))) (if (or (zero? l)