From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] Fix clock report when not clocking an entry Date: Mon, 17 May 2010 07:51:56 -0400 Message-ID: <1274097116-15970-1-git-send-email-bernt@norang.ca> References: <0B970D2C-3E2D-40B6-BCFE-4FCA5487DF0A@gmail.com> Return-path: Received: from [140.186.70.92] (port=37760 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODyrk-0005z7-Kt for emacs-orgmode@gnu.org; Mon, 17 May 2010 07:52:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODyri-0003hu-AQ for emacs-orgmode@gnu.org; Mon, 17 May 2010 07:52:12 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:53892) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODyri-0003ho-8J for emacs-orgmode@gnu.org; Mon, 17 May 2010 07:52:10 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1ODyrh-000JHx-LX for emacs-orgmode@gnu.org; Mon, 17 May 2010 11:52:09 +0000 In-Reply-To: <0B970D2C-3E2D-40B6-BCFE-4FCA5487DF0A@gmail.com> 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 I tried to save a few calls to org-float-time but org-clock-start-time is not valid as a parameter to org-float-time when it is an empty string (when you are not clocking anything). Verify tstart and tend are non-nil so we can compare them to the current clocking time using <= and >= --- I need to test more :/ I ran into two cases this morning where the clock report patch throws an error. Here's a fix for both. -Bernt lisp/org-clock.el | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 07e2e45..68a40ce 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,17 +1396,18 @@ 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 - (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-clock-start-time-as-float) 60))) - (setq t1 (+ t1 time))))) + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + tstart + tend + (>= (org-float-time org-clock-start-time) tstart) + (<= (org-float-time org-clock-start-time) tend)) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) (let* ((headline-forced - (get-text-property (point) + (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) -- 1.7.1.86.g0e460