* 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.
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))))
(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