From 01ffcca2dbf1bbe3eb6689b96353d7b7c40c3143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 22 May 2020 23:55:46 +0200 Subject: Cleanup in datetime. --- module/datetime.scm | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'module/datetime.scm') diff --git a/module/datetime.scm b/module/datetime.scm index de573c2e..5e531961 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -79,7 +79,7 @@ datetime? (date get-date) (time get-time%) - (tz tz) ; #f, 'UTC, 'Z + (tz tz) ; #f, "UTC", "Europe/Stockholm", ... ) (export get-date) @@ -132,8 +132,6 @@ (define-public (unix-time->datetime n) (tm->datetime (gmtime n))) -;; TODO prodedure to change TZ for datetime object - ;; datetime → datetime @@ -197,12 +195,6 @@ ;;; EQUIALENCE -;; 2020-01-10 + 0-0-30 = 2020-02-09 -;; 10 + 30 = 40 ; day + day -;; 40 > 31 ; target days > days in month -;; 2020-02-00 + 0-0- (40 - 31) ; -;; 2020-02-09 - (define-public (date= . args) (reduce (lambda (a b) (and b ; did a previous iteration return false? @@ -334,7 +326,6 @@ (define-values (days-fixed change*) (let loop ((target base) (change change)) - ;; (format (current-error-port) "1 ~s : ~s~%" target change) (if (>= (days-in-month target) (+ (day change) (day target))) ;; No date overflow, just add the change (values (set-> target (day = (+ (day change)))) @@ -573,9 +564,7 @@ (if (> (month a) (month b)) (loop (set-> b (year = (- 1)) - (month 11) - #; (day 30) - ) + (month 11)) (set (month a) = (- (1+ (month b))))) ;; elif (> (month b) (month a)) (values (set (month b) = (- (month a))) @@ -638,7 +627,7 @@ time: (parse-ics-time timestr) tz: tz))) -;; TODO this returns UTC time, but without a TZ component +;; TODO this returns UTC time, but without a TZ component, see tm->datetime (define-public (current-datetime) (unix-time->datetime ((@ (guile) current-time)))) @@ -675,8 +664,7 @@ `(datetime date: ,(parse-date% date) time: ,(parse-time% time) tz: ,(and (string= "Z" (string-take-right str 1)) - ;; TODO shouldn't this be "UTC"? - 'Z)))) + "UTC")))) (define (date-reader chr port) (unread-char chr port) -- cgit v1.2.3