From 7ce7c3b60505a72a1d46343d6595e1176d107e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 6 Oct 2019 22:49:14 +0200 Subject: Identified timezone problem. --- module/vcomponent.scm | 2 +- module/vcomponent/recurrence/generate.scm | 2 ++ module/vcomponent/timezone.scm | 36 ++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/module/vcomponent.scm b/module/vcomponent.scm index a65ef2d4..d8e6e61f 100644 --- a/module/vcomponent.scm +++ b/module/vcomponent.scm @@ -118,7 +118,7 @@ (unless (attr component "COLOR") (set! (attr component "COLOR") - (attr root "COLOR"))) + (attr root "COLOR"))) ;; return component)))) diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index 3f4cb869..78a5e3d5 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -54,6 +54,8 @@ (set! (attr ev 'DTSTART) (copy-time (attr ev 'DTSTART))) + (set! (attr ev 'date-obj) d) + (let ((i (interval r))) (case (freq r) ((SECONDLY) (mod! (second d) = (+ i))) diff --git a/module/vcomponent/timezone.scm b/module/vcomponent/timezone.scm index f6112ebc..a89c8c5c 100644 --- a/module/vcomponent/timezone.scm +++ b/module/vcomponent/timezone.scm @@ -10,7 +10,7 @@ :use-module ((vcomponent datetime) :select (ev-time :: "#" ;; TZID: Europe/Stockholm ;; X-LIC-LOCATION: Europe/Stockholm @@ -28,10 +28,44 @@ ;; : TZOFFSETFROM: +0200 ;; @end example +;;; GENERAL INFINITE EXTRAPOLATION OF TIMEZONE DATA IS IMPOSSIBLE, SINCE TIMEZONES +;;; DON'T CHANGE THAT PREDICTABLY + +;; @begin example +;; BEGIN:VTIMEZONE +;; TZID:Europe/Stockholm +;; BEGIN:STANDARD +;; DTSTART;VALUE=DATE-TIME:20181028T020000 +;; TZNAME:CET +;; TZOFFSETFROM:+0200 +;; TZOFFSETTO:+0100 +;; END:STANDARD +;; BEGIN:DAYLIGHT +;; DTSTART;VALUE=DATE-TIME:20190331T030000 +;; TZNAME:CEST +;; TZOFFSETFROM:+0100 +;; TZOFFSETTO:+0200 +;; END:DAYLIGHT +;; END:VTIMEZONE +;; @end example +;; This should really be parsed as: +;; STANDARD : [2018-10-28 02:00, 2019-03-31 03:00) +;; DAYLIGHT : [2019-03-21 03:00, ∞) + ;; Given a tz stream of length 2, takes the time difference between the DTSTART ;; of those two. And creates a new VTIMEZONE with that end time. ;; TODO set remaining properties, and type of the newly created component. (define (extrapolate-tz-stream strm) + (let ((nevent (copy-vcomponent (stream-car strm)))) + (set! (attr nevent 'DTSTART) + )) + + + ;; old code fails since (length standard) ≠ (length summer) + ;; Also, it copies the summmer time, making the alternation + ;; break (but that wasn't the primary problem) + + #; (let ((nevent (copy-vcomponent (stream-ref strm 1)))) (mod! (attr nevent 'DTSTART) = (add-duration (time-difference -- cgit v1.2.3