From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id GFYGOwy6RGZ3EQEAqHPOHw:P1 (envelope-from ) for ; Wed, 15 May 2024 15:35:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id GFYGOwy6RGZ3EQEAqHPOHw (envelope-from ) for ; Wed, 15 May 2024 15:35:09 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715780108; a=rsa-sha256; cv=none; b=UWk6NnqAbrznFW+7ht/61Q9JfUT+cZDjL/1G4HelAu6Rkaz22AHdAacBjQjBI/xZ+HYAL/ Wa2UH1dEgrLpHDJEtLelgQLT9f6HzTpXgyFAQ0h4pLtggmPhpEQPTUabs4HBdus7n+S5Pt YzSYVEPNo+E0GHF6w6f3p+SMk1qeonrPlV8adzW4OWquzNZDPmwDtpiVz0ziQec3maBsi2 ucQfPT679LandNJx/NgbqEeyVh8RdjFm6d51fwsTS2QLBS+jKD0mM1jlaLwdZAr8+Zv2gr 0RIJyH/mmibNDcZEZ/ACQo/iLjxVhPS2ql5ULxw6f1CFb85Z1zY84cCks8C6Yg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715780108; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=sclUvutuNl7tob8zfYl/GcR+RX+cq0nC6YSZtIZ9BYk=; b=nRL2XTWuVhDs3voUwXrnaX3uqvGP0YkOPYV+yK+AzOYXxxvY+jpFK9OTnkdfQaYsVIF/MR nwNjx6ss+dvo5vnNL5UTqbQiWY2J83yy1hGwvI9SEVzyasB3pfZW+t6SpScYUpwI00Cedi Lw6JVoUxT6N/bGOTjoL/QPPampX7IZhZxXLHV8Ffc06DVbq5IuY8mDXUwYol0TjAd5uxcg ZQ4RioRV+VRRc79Qyj/wBTFRtKfK1D9PRZUZf5GoGPW5vgmx629B4yiqwo9bPqt2kAG3mz fv9XfaV6BNW4SlMOUZu7bbizSFeuTvClW2SJteNpvi2kXt+H/NfU8kxOMFXr7Q== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D231926510 for ; Wed, 15 May 2024 15:35:08 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7Elu-0008G2-HY; Wed, 15 May 2024 09:34:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7Els-0008Fq-D4 for emacs-orgmode@gnu.org; Wed, 15 May 2024 09:34:16 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7Elq-0004jO-Bo for emacs-orgmode@gnu.org; Wed, 15 May 2024 09:34:16 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4VfZ290H4Kz1qsPH for ; Wed, 15 May 2024 15:34:08 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4VfZ285sVnz1qqlS for ; Wed, 15 May 2024 15:34:08 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id 7lKna-1QLOLd for ; Wed, 15 May 2024 15:34:08 +0200 (CEST) X-Auth-Info: tNyIFVnZSwIvLDbrIU/yEpxLsmWrneyd2I/+HyiqX5DM3fxzz4i+wm4W8vnRbdQb Received: from Whiteflame (ppp-212-114-182-31.dynamic.mnet-online.de [212.114.182.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA for ; Wed, 15 May 2024 15:34:08 +0200 (CEST) From: Raffael Stocker To: emacs-orgmode@gnu.org Subject: [BUG] Incorrect time calculation in agenda clockcheck User-Agent: mu4e 1.12.0; emacs 29.3 Date: Wed, 15 May 2024 15:34:01 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=212.18.0.9; envelope-from=r.stocker@mnet-mail.de; helo=mail-out.m-online.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: D231926510 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -6.47 X-Spam-Score: -6.47 X-TUID: uRv+VJwV6tPF --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi org-mode, in the Org Agenda clockcheck view, a warning about missing end time of a clocked-in task is displayed together with the already elapsed time of that task. If the starting time is in the future (this can happen if rounding and continuous clocking are used), the elapsed time is incorrect. For example, if a clocked-in task starts in 5 minutes, clockcheck will report something like "No end time: (0:55)". It would be more sensible to say "No end time: (-0:05)" or even "No end time: (in 0:05)". The culprit is the use of =E2=80=98org-duration-from-minutes=E2=80=99 in =E2=80=98org-agenda-show-clocking-issues=E2=80=99, because org-duration alw= ays assumes positive durations and is given a negative one here. The problem can easily be corrected with something like the following: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=org-agenda-primitive.patch diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index b3c7294a2..968b6bd50 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -6237,11 +6237,12 @@ defun org-agenda-show-clocking-issues (setq issue (format "No end time: (%s)" - (org-duration-from-minutes - (floor - (- (float-time (org-current-time)) - (float-time (org-time-string-to-time (match-string 1)))) - 60))) + (let ((diff (floor + (- (float-time (org-current-time)) + (float-time (org-time-string-to-time (match-string 1)))) + 60))) + (concat (if (> 0 diff) "-" "") + (org-duration-from-minutes (abs diff))))) face (or (plist-get pl :no-end-time-face) face)) (throw 'next t)) (setq ts (match-string 1) --=-=-= Content-Type: text/plain However, I believe it would be more useful (and general) to use a similar trick to teach org-duration to work with negative durations. Cheers, Raffael --=-=-=--