mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 03:40:56 -08:00
Fix 'timer-next-integral-multiple-of-time'
* lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time): Fix recent change for fractional values of SECS. (Bug#33071) * test/lisp/emacs-lisp/timer-tests.el (timer-next-integral-multiple-of-time-2): New test.
This commit is contained in:
parent
d684f5d5bc
commit
efb214622a
2 changed files with 9 additions and 1 deletions
|
|
@ -101,7 +101,7 @@ of SECS seconds since the epoch. SECS may be a fraction."
|
|||
time
|
||||
(encode-time time 1000000000000)))
|
||||
(hz (cdr ticks-hz))
|
||||
(s-ticks (* secs hz))
|
||||
(s-ticks (round (* secs hz)))
|
||||
(more-ticks (+ (car ticks-hz) s-ticks)))
|
||||
(encode-time (cons (- more-ticks (% more-ticks s-ticks)) hz))))
|
||||
|
||||
|
|
|
|||
|
|
@ -44,4 +44,12 @@
|
|||
(timer-next-integral-multiple-of-time '(0 0 0 1) (1+ (ash 1 53)))
|
||||
(list (ash 1 (- 53 16)) 1))))
|
||||
|
||||
(ert-deftest timer-next-integral-multiple-of-time-2 ()
|
||||
"Test bug#33071."
|
||||
(let* ((tc (current-time))
|
||||
(tce (encode-time tc 100))
|
||||
(nt (timer-next-integral-multiple-of-time tc 0.01))
|
||||
(nte (encode-time nt 100)))
|
||||
(should (= (car nte) (1+ (car tce))))))
|
||||
|
||||
;;; timer-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue