summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-21 22:29:52 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-21 22:32:57 +0200
commit112c5ba479d52c3c36de5c7aafd14ab6bc075005 (patch)
tree23b73884cfb5f13204b959fbe946c1346f750fa1
parent877377ebb306141c52674cdc42fc0c05d2af648e (diff)
downloadorg-mode-112c5ba479d52c3c36de5c7aafd14ab6bc075005.tar.gz
org-clock: Remove daylight saving time offset in duration
* lisp/org-clock.el (org-clock-out): (org-clock-sum): (org-clocktable-steps): (org-clock-update-time-maybe): Use UTC to compute time differences. * testing/lisp/test-org-clock.el (test-org-clock/clocktable/scope): Update test.
-rw-r--r--lisp/org-clock.el18
-rw-r--r--testing/lisp/test-org-clock.el6
2 files changed, 13 insertions, 11 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 9ca98b0..cb6a6c9 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1587,9 +1587,9 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
+ (apply #'encode-time (org-parse-time-string te nil t)))
(float-time
- (apply #'encode-time (org-parse-time-string ts))))
+ (apply #'encode-time (org-parse-time-string ts nil t))))
h (floor (/ s 3600))
s (- s (* 3600 h))
m (floor (/ s 60))
@@ -1823,9 +1823,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(setq ts (match-string 2)
te (match-string 3)
ts (float-time
- (apply #'encode-time (org-parse-time-string ts)))
+ (apply #'encode-time (org-parse-time-string ts nil t)))
te (float-time
- (apply #'encode-time (org-parse-time-string te)))
+ (apply #'encode-time (org-parse-time-string te nil t)))
ts (if tstart (max ts tstart) ts)
te (if tend (min te tend) te)
dt (- te ts)
@@ -2701,14 +2701,16 @@ LEVEL is an integer. Indent by two spaces per level above 1."
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
(setq ts (float-time (encode-time 0 0 0 day month year)))))
(ts
- (setq ts (float-time (apply #'encode-time (org-parse-time-string ts))))))
+ (setq ts (float-time
+ (apply #'encode-time (org-parse-time-string ts nil t))))))
(cond
((numberp te)
;; Likewise for te.
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
(setq te (float-time (encode-time 0 0 0 day month year)))))
(te
- (setq te (float-time (apply #'encode-time (org-parse-time-string te))))))
+ (setq te (float-time
+ (apply #'encode-time (org-parse-time-string te nil t))))))
(setq tsb
(if (eq step0 'week)
(- ts (* 86400 (- (nth 6 (decode-time (seconds-to-time ts))) ws)))
@@ -2885,9 +2887,9 @@ Otherwise, return nil."
(setq ts (match-string 1)
te (match-string 3))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
+ (apply #'encode-time (org-parse-time-string te nil t)))
(float-time
- (apply #'encode-time (org-parse-time-string ts))))
+ (apply #'encode-time (org-parse-time-string ts nil t))))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 6d4cbdb..bcc19bb 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -347,13 +347,13 @@ contents. The clocktable doesn't appear in the buffer."
(equal
"| Headline | Time | |
|--------------+-------------+-----|
-| *Total time* | *704d 9:01* | foo |
+| *Total time* | *704d 8:01* | foo |
|--------------+-------------+-----|
-| Test | 704d 9:01 | foo |
+| Test | 704d 8:01 | foo |
"
(org-test-with-temp-text-in-file
"* Test
-CLOCK: [2012-03-29 Thu 16:40]--[2014-03-04 Thu 00:41] => 16905:01
+CLOCK: [2012-03-29 Thu 16:40]--[2014-03-04 Thu 00:41] => 16904:01
#+BEGIN: clocktable :scope file-with-archives
#+TBLFM: $3=string(\"foo\")