[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:19:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Евгений Михайлов
>> <lewwadoo@gmail.com>
>> Date: Sat, 8 May 2021 19:55:10 +0300
>>
>> (my-mins-between "11:30" "12:04")
>>
>> (defun my-mins-between (time1 time2)
>> "Return the minutes between HH:mm strings TIME1 and TIME2."
>> (let ((diff (apply #'time-subtract
>> (mapcar (lambda (time)
>> (encode-time (decoded-time-set-defaults
>> (parse-time-string time))))
>> (list time1 time2)))))
>> (/ (float-time diff) 60)))
>>
>> Debugger entered--Lisp error: (error "Invalid time specification")
>> encode-time((0 30 11 1 1 0 nil -1 nil))
>> (lambda (time) (encode-time (decoded-time-set-defaults (parse-time-string
>> time))))("11:30")
>> mapcar((lambda (time) (encode-time (decoded-time-set-defaults
>> (parse-time-string time)))) ("11:30"
>> "12:04"))
>
> I guess the problem is in decoded-time-set-defaults, if anywhere.
Lars?
FWIW there is a similar pattern in the function iso8601--encode-time.
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?
> 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.
The other decoded time fields resulting from parsing don't matter, as
long as they are equivalent for both strings.
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 <=
- 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)), 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