From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#59506: 29.0.50; (time-since nil) return format change Date: Wed, 23 Nov 2022 10:13:38 +0100 Message-ID: References: <875yf6w013.fsf@luois.me> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000572a1c05ee1fb692" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31131"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59506@debbugs.gnu.org To: Merrick Luo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 23 10:15:20 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxlqh-0007qH-Pd for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Nov 2022 10:15:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxlqU-00055S-Vv; Wed, 23 Nov 2022 04:15:07 -0500 Original-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 1oxlqQ-000559-HK for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 04:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxlqQ-0007Ju-6v for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 04:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxlqQ-0000Eg-0J for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 04:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Nov 2022 09:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59506 X-GNU-PR-Package: emacs Original-Received: via spool by 59506-submit@debbugs.gnu.org id=B59506.1669194864850 (code B ref 59506); Wed, 23 Nov 2022 09:15:01 +0000 Original-Received: (at 59506) by debbugs.gnu.org; 23 Nov 2022 09:14:24 +0000 Original-Received: from localhost ([127.0.0.1]:53632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxlpo-0000Dd-9k for submit@debbugs.gnu.org; Wed, 23 Nov 2022 04:14:24 -0500 Original-Received: from mail-ed1-f48.google.com ([209.85.208.48]:43714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxlpl-0000DP-F8 for 59506@debbugs.gnu.org; Wed, 23 Nov 2022 04:14:22 -0500 Original-Received: by mail-ed1-f48.google.com with SMTP id y24so18945993edi.10 for <59506@debbugs.gnu.org>; Wed, 23 Nov 2022 01:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rWy1cbbYgvr6xAjJ6m7cvA6AFNjaGHCU21qxU+uZWjc=; b=TyS0/zq31rqxZOua2cDRzpqxR41ZSpcLB4/0gROYxbOArw2DoBlPOFDBoOnbcJw2Q2 ykF4/pkV3BEHcRWcWQeos8o5+gfxIhxK1msqSiqOfhWDLc9zjsFBDuh8yZnJVnHKax/S VYY2p1vGBrVHw1DenVQn3Ir1qEa1EzZcFQeAG9VZFri3JLSxXei/Rv66tqaSP1kvZlH+ J3hdbntXEZGIj7XE92JXORudJIn5YjCGRVM7YDtBn87HwPl6MRTTQcmpNtzI+XnBQuVT jixZnfpbAd4M+ejmM++8rSOtkSo/lF7Euhiipy/yQxYOD+6+ZnXYtAykDuO950gQmJgv 8njg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rWy1cbbYgvr6xAjJ6m7cvA6AFNjaGHCU21qxU+uZWjc=; b=mUI5pFNDKFkpPsIeFMn9iBSI+oRv2d6Jk1EWVm4r2eW9zV8WJ25EYEPloYDOzboRqa Oud7heH+b8RWahCYddYBgBwvKyyZ6g1nE/LAKqLU+dPRh+yqz7dlMmVfF7Cw2ITxi7PO TKdow4M1s5Lo6qCJAoTDXF6MC3/xeTs/bufBodxNHwMZ9OI9uWY5/gAnVJCCU+277gtQ C+MZfjfrjLTS4Lm19LYYvJDYvLMJJmnN6oODq058rE4jSf2uOXcw2G2jPiKJmLjTJvH7 j1ZwbTTH3BcxcQlguOLFxbyPfQPHEsbxvmiPxVSziuGlwE9cpmi67eCb4+VYeP5lX6nP wEXQ== X-Gm-Message-State: ANoB5pkvIeNBSVmMaz8HVhQ7pqH06mNxqr6NqxmsK68TNKvODV+y86bI x3KXcdB+xPHwDYmL451a7+OQdmbfkAkPnjiVeEM= X-Google-Smtp-Source: AA0mqf6jsPPxGYoS4C3k1gWeJhxGoF22tZjXfgmiiT+dmB3dreuu9D7VK4+Sz/T/66xGlMJqugMYKbraXSQYeEahTJA= X-Received: by 2002:a05:6402:444c:b0:462:2e27:3bf2 with SMTP id o12-20020a056402444c00b004622e273bf2mr24812100edb.13.1669194854113; Wed, 23 Nov 2022 01:14:14 -0800 (PST) In-Reply-To: <875yf6w013.fsf@luois.me> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248721 Archived-At: --000000000000572a1c05ee1fb692 Content-Type: text/plain; charset="UTF-8" In most cases, nil is assumed to be the current time. `time-subtract' is doing that here. It could be "fixed" so diff --git i/lisp/calendar/time-date.el w/lisp/calendar/time-date.el index bbdcaa4db4..27ce10d7d6 100644 --- i/lisp/calendar/time-date.el +++ w/lisp/calendar/time-date.el @@ -200,5 +200,5 @@ time-since ;; Convert date strings to internal time. (setq time (date-to-time time))) - (time-subtract nil time)) + (time-subtract nil (or time (current-time)))) ;;;###autoload but that would make the result inconsistent: ELISP> (time-since nil) (0 0 0 0) ELISP> (time-since nil) (0 0 1 0) I'm not sure that's better. And you can always do (time-since (or time (current-time))) --000000000000572a1c05ee1fb692 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In most cases, nil is assumed to be the current time. `time-= subtract' is doing that here.

It could be "fixed" so

diff --git i/lisp/calendar/time-date.el w/lisp/calendar/time-date.el
= index bbdcaa4db4..27ce10d7d6 100644
--- i/lisp/calendar/time-date.el
= +++ w/lisp/calendar/time-date.el
@@ -200,5 +200,5 @@ time-since
=C2= =A0 =C2=A0 =C2=A0;; Convert date strings to internal time.
=C2=A0 =C2=A0= =C2=A0(setq time (date-to-time time)))
- =C2=A0(time-subtract nil time)= )
+ =C2=A0(time-subtract nil (or time (current-time))))
=C2=A0
=C2= =A0;;;###autoload

but that would make the result inconsistent= :

ELISP> (time-since nil)
(0 0 0 0)
ELISP> (time-since nil)
(0 0 1 0)


I'm not sur= e that's better. And you can always do=C2=A0

(time-since (or time (current-time)))

--000000000000572a1c05ee1fb692--