aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-10-06 22:49:14 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-10-15 20:05:00 +0200
commit7ce7c3b60505a72a1d46343d6595e1176d107e84 (patch)
tree414dce72e9744ecc5bdba1ccc8cd128168c908c9
parentRemove tailing null from parsed color files. (diff)
downloadcalp-7ce7c3b60505a72a1d46343d6595e1176d107e84.tar.gz
calp-7ce7c3b60505a72a1d46343d6595e1176d107e84.tar.xz
Identified timezone problem.
-rw-r--r--module/vcomponent.scm2
-rw-r--r--module/vcomponent/recurrence/generate.scm2
-rw-r--r--module/vcomponent/timezone.scm36
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<?))
)
-;;@begin exampe
+;;@begin example
;; <VTIMEZONE> :: "#<vcomponent 558c5da80fc0>"
;; 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