iens

Manager of links to read
git clone https://git.instinctive.eu/iens.git
Log | Files | Refs | README | LICENSE

commit 8dec0821d88cba42a180c097979a9cb15749c0ea
parent 8d030ba0309392e6adebe6395eda1cd9ffe599cc
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Sat,  6 Jan 2024 16:55:08 +0000

RFC-3339 time representation can be local or UTC
Diffstat:
Msrc/iens.scm | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/iens.scm b/src/iens.scm @@ -38,8 +38,8 @@ (and (>= ls lms) (substring=? s maybe-suffix (- ls lms))))) -(define (rfc-3339 seconds) - (let ((time-str (time->string (seconds->local-time seconds) "%FT%T%z"))) +(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") @@ -47,6 +47,12 @@ ":" (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) @@ -165,6 +171,8 @@ (define (read-config!) (set! display-trace (not (zero? (get-config/default "display-trace" 0)))) (set! config-verbose (not (zero? (get-config/default "verbose" 0)))) + (set! rfc-3339 (if (zero? (get-config/default "local-time" 1)) + rfc-3339-utc rfc-3339-local)) (set! config-author-name (get-config "author-name")) (set! config-author-email (get-config "author-email")) (set! config-author-uri (get-config "author-uri"))