bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil))
Date: Sun, 09 May 2021 09:46:56 +0300

> 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.

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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]