aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/timer.el2
-rw-r--r--test/lisp/emacs-lisp/timer-tests.el8
2 files changed, 9 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 927e640feaa..e140738d9f3 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -101,7 +101,7 @@ of SECS seconds since the epoch. SECS may be a fraction."
101 time 101 time
102 (encode-time time 1000000000000))) 102 (encode-time time 1000000000000)))
103 (hz (cdr ticks-hz)) 103 (hz (cdr ticks-hz))
104 (s-ticks (* secs hz)) 104 (s-ticks (round (* secs hz)))
105 (more-ticks (+ (car ticks-hz) s-ticks))) 105 (more-ticks (+ (car ticks-hz) s-ticks)))
106 (encode-time (cons (- more-ticks (% more-ticks s-ticks)) hz)))) 106 (encode-time (cons (- more-ticks (% more-ticks s-ticks)) hz))))
107 107
diff --git a/test/lisp/emacs-lisp/timer-tests.el b/test/lisp/emacs-lisp/timer-tests.el
index c5971ee7687..7a5b9263b0b 100644
--- a/test/lisp/emacs-lisp/timer-tests.el
+++ b/test/lisp/emacs-lisp/timer-tests.el
@@ -44,4 +44,12 @@
44 (timer-next-integral-multiple-of-time '(0 0 0 1) (1+ (ash 1 53))) 44 (timer-next-integral-multiple-of-time '(0 0 0 1) (1+ (ash 1 53)))
45 (list (ash 1 (- 53 16)) 1)))) 45 (list (ash 1 (- 53 16)) 1))))
46 46
47(ert-deftest timer-next-integral-multiple-of-time-2 ()
48 "Test bug#33071."
49 (let* ((tc (current-time))
50 (tce (encode-time tc 100))
51 (nt (timer-next-integral-multiple-of-time tc 0.01))
52 (nte (encode-time nt 100)))
53 (should (= (car nte) (1+ (car tce))))))
54
47;;; timer-tests.el ends here 55;;; timer-tests.el ends here