From 86ae614050a1aba19a2d14e12ff7b62cc47b778c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 6 Oct 2019 22:56:35 +0200 Subject: Slight impromevents to parse-offset. --- module/vcomponent/timezone.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/module/vcomponent/timezone.scm b/module/vcomponent/timezone.scm index dde32cc2..f6112ebc 100644 --- a/module/vcomponent/timezone.scm +++ b/module/vcomponent/timezone.scm @@ -58,11 +58,13 @@ [else (stream-zip strm (stream-cdr strm))]))) +;; str ::= ±[0-9]{4} +;; str → int seconds (define (parse-offset str) - (let* (((pm h1 h0 m1 m0) (string->list str))) - ((primitive-eval (symbol pm)) - (+ (* 60 (string->number (list->string (list m1 m0)))) - (* 60 60 (string->number (list->string (list h1 h0)))))))) + (let* (((± h1 h0 m1 m0) (string->list str))) + ((primitive-eval (symbol ±)) + (+ (* 60 (string->number (string m1 m0))) + (* 60 60 (string->number (string h1 h0))))))) ;; Finds the VTIMEZONE with id @var{tzid} in calendar. ;; Crashes on error. -- cgit v1.2.3