Commit e5da45fd authored by Gerd Moellmann's avatar Gerd Moellmann

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

parent 08b1f8a1
......@@ -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))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment