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:
parent
08b1f8a12e
commit
e5da45fda7
1 changed files with 4 additions and 2 deletions
|
|
@ -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))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue