Function: timer-next-integral-multiple-of-time

timer-next-integral-multiple-of-time is a byte-compiled function defined in timer.el.gz.

Signature

(timer-next-integral-multiple-of-time TIME SECS)

Documentation

Yield the next value after TIME that is an integral multiple of SECS.

More precisely, the next value, after TIME, that is an integral multiple of SECS seconds since the epoch. SECS may be a fraction.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/timer.el.gz
(defun timer-next-integral-multiple-of-time (time secs)
  "Yield the next value after TIME that is an integral multiple of SECS.
More precisely, the next value, after TIME, that is an integral multiple
of SECS seconds since the epoch.  SECS may be a fraction."
  (let* ((ticks-hz (time-convert time t))
	 (ticks (car ticks-hz))
	 (hz (cdr ticks-hz))
	 trunc-s-ticks)
    (while (let ((s-ticks (* secs hz)))
	     (setq trunc-s-ticks (truncate s-ticks))
	     (/= s-ticks trunc-s-ticks))
      (setq ticks (ash ticks 1))
      (setq hz (ash hz 1)))
    (let ((more-ticks (+ ticks trunc-s-ticks)))
      (time-convert (cons (- more-ticks (% more-ticks trunc-s-ticks)) hz)))))