From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)) Date: Sun, 09 May 2021 09:54:32 +0100 Message-ID: <87tunc4793.fsf@tcd.ie> References: <83tunc8kv3.fsf@gnu.org> <87fsyw5nfg.fsf@tcd.ie> <83fsyw8g7f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25263"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: larsi@gnus.org, 48298@debbugs.gnu.org, lewwadoo@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 09 10:56:10 2021 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 1lffEQ-0006Sf-2l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 10:56:10 +0200 Original-Received: from localhost ([::1]:49026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lffEO-00044V-Mu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 04:56:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lffDK-0002nH-Gm for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lffDJ-0000iw-QA for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lffDJ-0002SC-O9 for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 May 2021 08:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48298 X-GNU-PR-Package: emacs Original-Received: via spool by 48298-submit@debbugs.gnu.org id=B48298.16205504869419 (code B ref 48298); Sun, 09 May 2021 08:55:01 +0000 Original-Received: (at 48298) by debbugs.gnu.org; 9 May 2021 08:54:46 +0000 Original-Received: from localhost ([127.0.0.1]:55141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lffD1-0002Rr-0V for submit@debbugs.gnu.org; Sun, 09 May 2021 04:54:46 -0400 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:33602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lffCz-0002Ri-97 for 48298@debbugs.gnu.org; Sun, 09 May 2021 04:54:41 -0400 Original-Received: by mail-wm1-f46.google.com with SMTP id o26-20020a1c4d1a0000b0290146e1feccdaso8285480wmh.0 for <48298@debbugs.gnu.org>; Sun, 09 May 2021 01:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oq9HlQBCYHv3HCyN/ojHv5zMU04o48526xeOGixu8vM=; b=ayZJdrEXmEYPjXQlUdYVhfiWfwKeYHqzH5ZPQOJz/bCAeEhpUnsW2U9xApJfUTEajd qiVWERMVgpvTRCnBrvFNC9Mb4WnWfSRvqWNUYluY5mHY6rmzOXIkZkiElMBw1j9nh5RV Zs4hSDjw2QZnoNaeafxQtgdY8EKxyxQxDFeHxQHXHcMVfhzRDoq6VPwgIgxJ2dHl+4d1 orZko8IoPRmmHoHbN970lYh1H1Cah7URhORfg9DVbiixyB76pM92XNIA8XzfhVSxt1Zl gqKIOSQtML0mb2lRscFfPIRE86JdS9/l534nszD4iceIxnx6xm0hVHAlcsWe8TPHivaj 3Pmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=oq9HlQBCYHv3HCyN/ojHv5zMU04o48526xeOGixu8vM=; b=lgE/wLFPf2mVrwU/b5zAhz6IT01u64kZ+o7UH81ktXM8gC2+xoVuFt01n3jjAmfF86 TUPIvdcYQY0XfTgVbbpOpA4rafVwjg8e9j7aCDezK/2XnZBXKgNmuBQ76rW56ANwPq/B Tz1rB6gzFvLdexopuY/6yYzy8bMQbokCbKXJaR+Mo86PfeXGK03ai1qhfIIHpTzDnbXO cA/oWfT7wVs9DAKI1nsk+T4vHycYIe0LUqXjn+o//brwQekjH59xBhTU3Zud42h+VaMZ xHdnevW7MpEYtJ0xEtVQZGFvx5RBqhCtpMzVX+RR2I2B0z9S1d03CzlJugzbqcMpBBLH NOig== X-Gm-Message-State: AOAM533HKw2h9+H9CwD2vKX6YFVrrBHnq8lv9Ls1kJbnhoFv46GKkvsF XyUHBTvF7xJ42FIqL8Kg4cYOCQ== X-Google-Smtp-Source: ABdhPJxXItVTiYmFz1kdnG+FoltaXeK50SoCcQAZaExftE7gi4DPjboP3E1KeuPjN3yIJkTVY3uxqw== X-Received: by 2002:a05:600c:b54:: with SMTP id k20mr20405498wmr.189.1620550475426; Sun, 09 May 2021 01:54:35 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id z6sm14467442wmf.9.2021.05.09.01.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 01:54:34 -0700 (PDT) In-Reply-To: <83fsyw8g7f.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 09 May 2021 11:27:32 +0300") 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" Xref: news.gmane.io gmane.emacs.bugs:206054 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: "Basil L. Contovounesios" >> Cc: =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=9C=D0=B8=D1=85=D0=B0= =D0=B9=D0=BB=D0=BE=D0=B2 >> , 48298@debbugs.gnu.org >> Date: Sun, 09 May 2021 09:19:47 +0100 >>=20 >> > I guess the problem is in decoded-time-set-defaults, if anywhere. >>=20 >> Lars? > > As the minimum fix, perhaps instead of using zero as the missing year > we should use 1970, as zero could not be representable on some > systems. Also 1970 is implied by the function's docstring and announcement. All tests seem to pass with this: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Default-to-1970-in-decoded-time-set-defaults.patch >From 3bb0de4f76265d3be28c0b38046f1a08d93259b9 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 9 May 2021 09:50:00 +0100 Subject: [PATCH] Default to 1970 in decoded-time-set-defaults * lisp/calendar/time-date.el (decoded-time-set-defaults): Set an unspecified year field to 1970, as promised in the docstring, and to ensure it's representable on all systems (bug#48298). --- lisp/calendar/time-date.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 2df57a3c33..e93a74810d 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -539,7 +539,7 @@ decoded-time-set-defaults (unless (decoded-time-month time) (setf (decoded-time-month time) 1)) (unless (decoded-time-year time) - (setf (decoded-time-year time) 0)) + (setf (decoded-time-year time) 1970)) ;; When we don't have a time zone, default to DEFAULT-ZONE without ;; DST if DEFAULT-ZONE if given, and to unknown DST otherwise. -- 2.30.2 --=-=-= Content-Type: text/plain Evgeny, does that fix the error that you see? >> BTW I just noticed that decoded-time-set-defaults was mistakenly >> announced in NEWS as encoded-time-set-defaults - should that be fixed on >> emacs-27 or master? > > Master, I guess. Done in 3d276324ed. >> > However, I'm not sure I understand the idea behind your >> > my-mins-between: how did you expect Emacs to guess the year you had in >> > mind? >> >> The year doesn't matter, since my-mins-between cares only about the >> relative difference between strings of the form "HH:mm", i.e. the hours >> and minutes fields. > > Yes, it does matter: see the comment by Andreas. In general, sure, but perhaps not in Evgeny's specific use case as described in https://bugs.gnu.org/48290#11. Thanks, -- Basil --=-=-=--