]> code.delx.au - gnu-emacs/blobdiff - lisp/timer.el
(isearch-resume-enabled): New variable.
[gnu-emacs] / lisp / timer.el
index e91fd64ab2ff8b062dfa0bd0345cb293375494b7..0c159c6023dba8d7ab0639607fbc9d61bdc213e9 100644 (file)
@@ -1,4 +1,4 @@
-;;; timer.el --- run a function with args at some time in future.
+;;; timer.el --- run a function with args at some time in future
 
 ;; Copyright (C) 1996 Free Software Foundation, Inc.
 
@@ -116,9 +116,11 @@ SECS may be a fraction."
     (setq low (+ low (floor secs)))
 
     ;; Normalize
-    (setq low (+ low (/ micro 1000000)))
+    ;; `/' rounds towards zero while `mod' returns a positive number,
+    ;; so we can't rely on (= a (+ (* 100 (/ a 100)) (mod a 100))).
+    (setq low (+ low (/ micro 1000000) (if (< micro 0) -1 0)))
     (setq micro (mod micro 1000000))
-    (setq high (+ high (/ low 65536)))
+    (setq high (+ high (/ low 65536) (if (< low 0) -1 0)))
     (setq low (logand low 65535))
 
     (list high low (and (/= micro 0) micro))))
@@ -387,7 +389,7 @@ This function returns a timer object which you can use in `cancel-timer'."
   (let ((timer (timer-create)))
     (timer-set-function timer function args)
     (timer-set-idle-time timer secs repeat)
-    (timer-activate-when-idle timer t)
+    (timer-activate-when-idle timer)
     timer))
 \f
 (defun with-timeout-handler (tag)