From 4080b0c7e97acb7357a7ab85589b324e382e0d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 Nov 2019 17:08:38 +0100 Subject: Add let-env. --- module/vcomponent/recurrence/generate.scm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'module/vcomponent/recurrence/generate.scm') diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index 50ce83e5..3988141c 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -44,13 +44,8 @@ ;; Specifically, 23h or 25h when going between summer and "normal" time. (define (next-event ev r) - (let ((e (copy-vcomponent ev)) - (tz (getenv "TZ"))) - ;; (setenv "TZ" (car (prop (attr* e 'DTSTART) 'TZID))) - (aif (prop (attr* e 'DTSTART) 'TZID) - (setenv "TZ" (car it)) - ;; Should missing be this, or explicitly GMT? - (unsetenv "TZ")) + (let ((e (copy-vcomponent ev))) + (let-env ((TZ (and=> (prop (attr* e 'DTSTART) 'TZID) car)))) (let ((d (time-utc->date (attr e 'DTSTART))) (i (interval r))) @@ -72,8 +67,6 @@ (set! (attr e 'DTEND) (add-duration (attr e 'DTSTART) (attr e 'DURATION)))) - (setenv "TZ" tz) - e)) #; -- cgit v1.2.3