[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1
From: |
Basil L. Contovounesios |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: "Basil L. Contovounesios" <contovob@tcd.ie>
>> Cc: Евгений Михайлов
>> <lewwadoo@gmail.com>, 48298@debbugs.gnu.org
>> Date: Sun, 09 May 2021 09:19:47 +0100
>>
>> > I guess the problem is in decoded-time-set-defaults, if anywhere.
>>
>> 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:
>From 3bb0de4f76265d3be28c0b38046f1a08d93259b9 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
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
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
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Евгений Михайлов, 2021/05/08
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/08
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Eli Zaretskii, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Eli Zaretskii, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)),
Basil L. Contovounesios <=
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Lars Ingebrigtsen, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Lars Ingebrigtsen, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Eli Zaretskii, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Eli Zaretskii, 2021/05/09
- bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Basil L. Contovounesios, 2021/05/09
bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)), Andreas Schwab, 2021/05/09
bug#48298:, Евгений Михайлов, 2021/05/11