aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/timezone.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/vcomponent/timezone.scm')
-rw-r--r--module/vcomponent/timezone.scm36
1 files changed, 35 insertions, 1 deletions
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