Function: gnus-demon-time-to-step
gnus-demon-time-to-step is a byte-compiled function defined in
gnus-demon.el.gz.
Signature
(gnus-demon-time-to-step TIME)
Documentation
Find out how many steps to TIME, which is on the form "17:43".
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-demon.el.gz
(defun gnus-demon-time-to-step (time)
"Find out how many steps to TIME, which is on the form \"17:43\"."
(let* ((now (current-time))
;; obtain NOW as discrete components -- make a vector for speed
(nowParts (decode-time now))
;; obtain THEN as discrete components
(thenParts (parse-time-string time))
(thenHour (decoded-time-hour thenParts))
(thenMin (decoded-time-minute thenParts))
;; convert time as elements into number of seconds since EPOCH.
(then (encode-time
0
thenMin
thenHour
;; If THEN is earlier than NOW, make it
;; same time tomorrow. Doc for encode-time
;; says that this is OK.
(+ (decoded-time-day nowParts)
(if (or (< thenHour (decoded-time-hour nowParts))
(and (= thenHour
(decoded-time-hour nowParts))
(<= thenMin
(decoded-time-minute nowParts))))
1 0))
(decoded-time-month nowParts)
(decoded-time-year nowParts)
(decoded-time-weekday nowParts)
(decoded-time-dst nowParts)
(decoded-time-zone nowParts)))
(diff (float-time (time-subtract then now))))
;; Return number of timesteps in the number of seconds.
(round diff gnus-demon-timestep)))