Commit dfba918c authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Allow adding time zones

parent c6323320
Pipeline #2305 failed with stage
in 53 minutes and 45 seconds
......@@ -421,6 +421,10 @@ changes in daylight saving time are not taken into account."
(setq seconds (+ (* (or (decoded-time-hour delta) 0) 3600)
(* (or (decoded-time-minute delta) 0) 60)
(or (decoded-time-second delta) 0)))
;; Time zone adjustments are basically the same as time adjustments.
(setq seconds (+ seconds (or (decoded-time-zone delta) 0)))
(cond
((> seconds 0)
(decoded-time--alter-second time seconds t))
......
......@@ -97,6 +97,13 @@
'(12 15 16 9 7 2019 1 t 7200)))
))
(ert-deftest test-decoded-add-zone ()
(let ((time '(12 15 16 8 7 2019 1 t 7200)))
(should (equal (decoded-time-add time (mdec :zone -3600))
'(12 15 15 8 7 2019 1 t 7200)))
(should (equal (decoded-time-add time (mdec :zone -7200))
'(12 15 14 8 7 2019 1 t 7200)))))
(require 'ert)
;;; time-date-tests.el ends here
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