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