1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

(timer-relative-time): Fix computation for negative `micro'.

This commit is contained in:
Gerd Moellmann 2001-10-05 09:26:53 +00:00
parent 08b1f8a12e
commit e5da45fda7

View file

@ -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))))