comparison lisp/gnus/gnus-demon.el @ 82951:0fde48feb604

Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
author Andreas Schwab <schwab@suse.de>
date Thu, 22 Jul 2004 16:45:51 +0000
parents 695cf19ef79e
children a1964e18a9ba cce1c0ee76ee
comparison
equal deleted inserted replaced
56503:8bbd2323fbf2 82951:0fde48feb604
1 ;;; gnus-demon.el --- daemonic Gnus behaviour 1 ;;; gnus-demon.el --- daemonic Gnus behaviour
2 ;; Copyright (C) 1995,96,97,98,99 Free Software Foundation, Inc. 2
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003
4 ;; Free Software Foundation, Inc.
3 5
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Keywords: news 7 ;; Keywords: news
6 8
7 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
146 (defun gnus-demon-time-to-step (time) 148 (defun gnus-demon-time-to-step (time)
147 "Find out how many seconds to TIME, which is on the form \"17:43\"." 149 "Find out how many seconds to TIME, which is on the form \"17:43\"."
148 (if (not (stringp time)) 150 (if (not (stringp time))
149 time 151 time
150 (let* ((now (current-time)) 152 (let* ((now (current-time))
151 ;; obtain NOW as discrete components -- make a vector for speed 153 ;; obtain NOW as discrete components -- make a vector for speed
152 (nowParts (decode-time now)) 154 (nowParts (decode-time now))
153 ;; obtain THEN as discrete components 155 ;; obtain THEN as discrete components
154 (thenParts (parse-time-string time)) 156 (thenParts (parse-time-string time))
155 (thenHour (elt thenParts 2)) 157 (thenHour (elt thenParts 2))
156 (thenMin (elt thenParts 1)) 158 (thenMin (elt thenParts 1))
157 ;; convert time as elements into number of seconds since EPOCH. 159 ;; convert time as elements into number of seconds since EPOCH.
158 (then (encode-time 0 160 (then (encode-time 0
159 thenMin 161 thenMin
160 thenHour 162 thenHour
161 ;; If THEN is earlier than NOW, make it 163 ;; If THEN is earlier than NOW, make it
162 ;; same time tomorrow. Doc for encode-time 164 ;; same time tomorrow. Doc for encode-time
163 ;; says that this is OK. 165 ;; says that this is OK.
164 (+ (elt nowParts 3) 166 (+ (elt nowParts 3)
165 (if (or (< thenHour (elt nowParts 2)) 167 (if (or (< thenHour (elt nowParts 2))
166 (and (= thenHour (elt nowParts 2)) 168 (and (= thenHour (elt nowParts 2))
167 (<= thenMin (elt nowParts 1)))) 169 (<= thenMin (elt nowParts 1))))
168 1 0)) 170 1 0))
169 (elt nowParts 4) 171 (elt nowParts 4)
170 (elt nowParts 5) 172 (elt nowParts 5)
171 (elt nowParts 6) 173 (elt nowParts 6)
172 (elt nowParts 7) 174 (elt nowParts 7)
173 (elt nowParts 8))) 175 (elt nowParts 8)))
174 ;; calculate number of seconds between NOW and THEN 176 ;; calculate number of seconds between NOW and THEN
175 (diff (+ (* 65536 (- (car then) (car now))) 177 (diff (+ (* 65536 (- (car then) (car now)))
176 (- (cadr then) (cadr now))))) 178 (- (cadr then) (cadr now)))))
177 ;; return number of timesteps in the number of seconds 179 ;; return number of timesteps in the number of seconds
178 (round (/ diff gnus-demon-timestep))))) 180 (round (/ diff gnus-demon-timestep)))))
179 181
180 (defun gnus-demon () 182 (defun gnus-demon ()
181 "The Gnus daemon that takes care of running all Gnus handlers." 183 "The Gnus daemon that takes care of running all Gnus handlers."