From 43a1d5e920116f59ac2a8246b95394330839b9cc Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 7 Aug 2017 13:25:20 +0200 Subject: [PATCH] org-clock: Fix `org-clock-get-sum-start' * lisp/org-clock.el (org-clock-get-sum-start): Return time as UTC. Reported-by: Josh Moller-Mara --- lisp/org-clock.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 6dce6f7c0..b276c2b53 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1418,11 +1418,13 @@ for a todo state to switch to, overriding the existing value (defun org-clock-get-sum-start () "Return the time from which clock times should be counted. -This is for the currently running clock as it is displayed -in the mode line. This function looks at the properties -LAST_REPEAT and in particular CLOCK_MODELINE_TOTAL and the -corresponding variable `org-clock-mode-line-total' and then -decides which time to use." + +This is for the currently running clock as it is displayed in the +mode line. This function looks at the properties LAST_REPEAT and +in particular CLOCK_MODELINE_TOTAL and the corresponding variable +`org-clock-mode-line-total' and then decides which time to use. + +The time is always returned as UTC." (let ((cmt (or (org-entry-get nil "CLOCK_MODELINE_TOTAL") (symbol-name org-clock-mode-line-total))) (lr (org-entry-get nil "LAST_REPEAT"))) @@ -1432,13 +1434,13 @@ decides which time to use." (current-time)) ((equal cmt "today") (setq org--msg-extra "showing today's task time.") - (let* ((dt (decode-time)) + (let* ((dt (decode-time nil t)) (hour (nth 2 dt)) (day (nth 3 dt))) (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) (setf (nth 2 dt) org-extend-today-until) - (setq dt (append (list 0 0) (nthcdr 2 dt))) - (apply 'encode-time dt))) + (setq dt (append (list 0 0) (nthcdr 2 dt) '(nil t))) + (apply #'encode-time dt))) ((or (equal cmt "all") (and (or (not cmt) (equal cmt "auto")) (not lr))) @@ -1448,9 +1450,7 @@ decides which time to use." (and (or (not cmt) (equal cmt "auto")) lr)) (setq org--msg-extra "showing task time since last repeat.") - (if (not lr) - nil - (org-time-string-to-time lr))) + (and lr (org-time-string-to-time lr t))) (t nil)))) (defun org-clock-find-position (find-unclosed)