diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-05-17 11:36:09 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-05-17 11:36:09 +0200 |
commit | 696c2bf8695bac9d4f6b506c73009a1d9f72c7a6 (patch) | |
tree | eaab6325429f2e9df82f7df01ffbf1fb725183f4 | |
parent | b84aa975e00d13008b2f29412e73223c5329b405 (diff) | |
download | org-mode-696c2bf8695bac9d4f6b506c73009a1d9f72c7a6.tar.gz |
Add running clock only to report if time scope is right
Patch by Bernt Hansen:
> When org-clock-report-include-clocking-task is set we always add the
> current clocking task to the clock report. This is incorrect if you
> are looking at an agenda clock report for a time range that does not
> include the current clocking task (e.g. yesterday or last week).
>
> Now we only include the current clocking task if the clock report
> date range includes the current clocking task start time.
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org-clock.el | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d5278ed..585b0c0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-05-17 Carsten Dominik <carsten.dominik@gmail.com> + + * org-clock.el (org-clock-sum): Don't include running clock if + the time block is wrong. + 2010-05-16 John Wiegley <jwiegley@gmail.com> * org-clock.el (org-clock-clock-in, org-clock-in): Added diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 504f0c9..07e2e45 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,12 +1396,15 @@ nil are excluded from the clock summation." (* 60 (string-to-number (match-string 4)))))) (t ;; A headline ;; Add the currently clocking item time to the total - (when (and org-clock-report-include-clocking-task - (equal (org-clocking-buffer) (current-buffer)) - (equal (marker-position org-clock-hd-marker) (point))) + (let ((org-clock-start-time-as-float (org-float-time org-clock-start-time))) + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + (>= org-clock-start-time-as-float tstart) + (<= org-clock-start-time-as-float tend)) (let ((time (floor (- (org-float-time) - (org-float-time org-clock-start-time)) 60))) - (setq t1 (+ t1 time)))) + org-clock-start-time-as-float) 60))) + (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) |