Commit c99a3b87 authored by Ulf Jasper's avatar Ulf Jasper
Browse files

Fix Bug#15408 (icalendar time zone problem)

2014-07-30 Christophe Deleuze <christophe.deleuze@free.fr>

	* calendar/icalendar.el (icalendar--decode-isodatetime): Use
	actual current-time-zone when converting to local time. (Bug#15408)

2014-07-30  Ulf Jasper  <ulf.jasper@web.de>

	* automated/icalendar-tests.el (icalendar--decode-isodatetime): New test.
parent 609fc791
2014-07-30 Christophe Deleuze <christophe.deleuze@free.fr>
* calendar/icalendar.el (icalendar--decode-isodatetime): Use
actual current-time-zone when converting to local time. (Bug#15408)
2014-07-29 Martin Rudalics <rudalics@gmx.at> 2014-07-29 Martin Rudalics <rudalics@gmx.at>
   
* window.el (window--state-put-2): Handle horizontal scroll * window.el (window--state-put-2): Handle horizontal scroll
......
...@@ -563,7 +563,12 @@ FIXME: multiple comma-separated values should be allowed!" ...@@ -563,7 +563,12 @@ FIXME: multiple comma-separated values should be allowed!"
;; UTC specifier present ;; UTC specifier present
(char-equal ?Z (aref isodatetimestring 15))) (char-equal ?Z (aref isodatetimestring 15)))
;; if not UTC add current-time-zone offset ;; if not UTC add current-time-zone offset
(setq second (+ (car (current-time-zone)) second))) ;; current-time-zone should be called with actual UTC time
;; (daylight saving at that time may differ to current one)
(setq second (+ (car (current-time-zone
(encode-time second minute hour day month year
0)))
second)))
;; shift if necessary ;; shift if necessary
(if day-shift (if day-shift
(let ((mdy (calendar-gregorian-from-absolute (let ((mdy (calendar-gregorian-from-absolute
......
2014-07-30 Ulf Jasper <ulf.jasper@web.de>
* automated/icalendar-tests.el (icalendar--decode-isodatetime): New test.
2014-07-28 Dmitry Antipov <dmantipov@yandex.ru> 2014-07-28 Dmitry Antipov <dmantipov@yandex.ru>
* automated/timer-tests.el (timer-tests-debug-timer-check): New test. * automated/timer-tests.el (timer-tests-debug-timer-check): New test.
......
...@@ -414,6 +414,38 @@ END:VEVENT ...@@ -414,6 +414,38 @@ END:VEVENT
(should (not result)) (should (not result))
)) ))
(ert-deftest icalendar--decode-isodatetime ()
"Test `icalendar--decode-isodatetime'."
(let ((tz (getenv "TZ"))
result)
(unwind-protect
(progn
;; Use Eastern European Time (UTC+1, UTC+2 daylight saving)
(setenv "TZ" "EET")
(message "%s" (current-time-zone (encode-time 0 0 10 1 1 2013 0)))
(message "%s" (current-time-zone (encode-time 0 0 10 1 8 2013 0)))
;; testcase: no time zone in input -> keep time as is
;; 1 Jan 2013 10:00
(should (equal '(0 0 10 1 1 2013 2 nil 7200)
(icalendar--decode-isodatetime "20130101T100000")))
;; 1 Aug 2013 10:00 (DST)
(should (equal '(0 0 10 1 8 2013 4 t 10800)
(icalendar--decode-isodatetime "20130801T100000")))
;; testcase: UTC time zone specifier in input -> convert to local time
;; 31 Dec 2013 23:00 UTC -> 1 Jan 2013 01:00 EET
(should (equal '(0 0 1 1 1 2014 3 nil 7200)
(icalendar--decode-isodatetime "20131231T230000Z")))
;; 1 Aug 2013 10:00 UTC -> 1 Aug 2013 13:00 EEST
(should (equal '(0 0 13 1 8 2013 4 t 10800)
(icalendar--decode-isodatetime "20130801T100000Z")))
)
;; restore time-zone even if something went terribly wrong
(setenv "TZ" tz))) )
;; ====================================================================== ;; ======================================================================
;; Export tests ;; Export tests
;; ====================================================================== ;; ======================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment