From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] clock reports: Only include current clocking task when range includes task Date: Sun, 16 May 2010 22:05:05 -0400 Message-ID: <1274061905-8553-1-git-send-email-bernt@norang.ca> Return-path: Received: from [140.186.70.92] (port=34804 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODpho-0004um-BY for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODphm-0004Wt-KF for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:05:20 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:54082) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODphm-0004Wg-Cs for emacs-orgmode@gnu.org; Sun, 16 May 2010 22:05:18 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1ODphl-0004ws-S9 for emacs-orgmode@gnu.org; Mon, 17 May 2010 02:05:17 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: 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. --- This patch is available at git://git.norang.ca for-carsten lisp/org-clock.el | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 504f0c9..e999690 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,12 +1396,16 @@ 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))) + (message "clock test %s %s %s" tstart org-clock-start-time-as-float tend) + (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)) -- 1.7.1.86.g0e460