diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-11-04 16:57:11 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-11-04 16:57:11 +0100 |
commit | b80bee1a5b5487f53391ac001ad4b3b58e2dbc3c (patch) | |
tree | e2fbf26a3be8856afd0ef1c00374ced78c212c84 | |
parent | Remove (vcomponent timezone). (diff) | |
download | calp-b80bee1a5b5487f53391ac001ad4b3b58e2dbc3c.tar.gz calp-b80bee1a5b5487f53391ac001ad4b3b58e2dbc3c.tar.xz |
Further cleanup in (vcomponent).
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent.scm | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/module/vcomponent.scm b/module/vcomponent.scm index 1bffe847..c1ee0e23 100644 --- a/module/vcomponent.scm +++ b/module/vcomponent.scm @@ -19,21 +19,9 @@ (re-export-modules (vcomponent base)) -(define string->time-utc - (compose date->time-utc parse-datetime)) - (define (parse-dates! cal) "Parse all start times into scheme date objects." - #; - (for tz in (filter (lambda (o) (eq? 'VTIMEZONE (type o))) (children cal)) - (for-each (lambda (p) (mod! (attr p "DTSTART") string->time-utc)) - (children tz)) - - ;; TZSET is the generated recurrence set of a timezone - (set! (attr tz 'X-HNH-TZSET) - (make-tz-set tz))) - (for ev in (filter (lambda (o) (eq? 'VEVENT (type o))) (children cal)) (let ((tz (getenv "TZ"))) (aif (prop (attr* ev 'DTSTART) 'TZID) @@ -59,18 +47,15 @@ (value eptr) (date->time-utc end-date)) (when (prop (attr* ev 'DTSTART) 'TZID) - ;; (format (current-error-port) "date = ~a~%" date) - (set! (zone-offset date) (zone-offset (time-utc->date (value dptr)))) - ;; (format (current-error-port) "date = ~a~%" date) - ;; set! (zone-offset date) (get-tz-offset ev) - - (set! - (value dptr) (date->time-utc date) - - ;; The standard says that DTEND must have the same - ;; timezone as DTSTART. Here we trust that blindly. - (zone-offset end-date) (zone-offset date) - (value eptr) (date->time-utc end-date)))) + ;; Re-align date to have correect timezone. This is since time->date gives + ;; correct, but the code above may (?) fail to update the timezone. + (set! (zone-offset date) (zone-offset (time-utc->date (value dptr))) + (value dptr) (date->time-utc date) + + ;; The standard says that DTEND must have the same + ;; timezone as DTSTART. Here we trust that blindly. + (zone-offset end-date) (zone-offset date) + (value eptr) (date->time-utc end-date)))) (setenv "TZ" tz)))) |