/[emacs]/emacs/lisp/timer.el
ViewVC logotype

Diff of /emacs/lisp/timer.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by gerd, Fri Oct 5 09:26:53 2001 UTC revision 1.25.4.1 by miles, Fri Apr 4 06:20:11 2003 UTC
# Line 45  Line 45 
45  (defun timer-set-time (timer time &optional delta)  (defun timer-set-time (timer time &optional delta)
46    "Set the trigger time of TIMER to TIME.    "Set the trigger time of TIMER to TIME.
47  TIME must be in the internal format returned by, e.g., `current-time'.  TIME must be in the internal format returned by, e.g., `current-time'.
48  If optional third argument DELTA is a non-zero integer, make the timer  If optional third argument DELTA is a positive number, make the timer
49  fire repeatedly that many seconds apart."  fire repeatedly that many seconds apart."
50    (or (timerp timer)    (or (timerp timer)
51        (error "Invalid timer"))        (error "Invalid timer"))
# Line 127  SECS may be a fraction." Line 127  SECS may be a fraction."
127    
128  (defun timer-inc-time (timer secs &optional usecs)  (defun timer-inc-time (timer secs &optional usecs)
129    "Increment the time set in TIMER by SECS seconds and USECS microseconds.    "Increment the time set in TIMER by SECS seconds and USECS microseconds.
130  SECS may be a fraction."  SECS may be a fraction.  If USECS is omitted, that means it is zero."
131    (let ((time (timer-relative-time    (let ((time (timer-relative-time
132                 (list (aref timer 1) (aref timer 2) (aref timer 3))                 (list (aref timer 1) (aref timer 2) (aref timer 3))
133                 secs                 secs
# Line 137  SECS may be a fraction." Line 137  SECS may be a fraction."
137      (aset timer 3 (or (nth 2 time) 0))))      (aset timer 3 (or (nth 2 time) 0))))
138    
139  (defun timer-set-time-with-usecs (timer time usecs &optional delta)  (defun timer-set-time-with-usecs (timer time usecs &optional delta)
140    "Set the trigger time of TIMER to TIME.    "Set the trigger time of TIMER to TIME plus USECS.
141  TIME must be in the internal format returned by, e.g., `current-time'.  TIME must be in the internal format returned by, e.g., `current-time'.
142  If optional third argument DELTA is a non-zero integer, make the timer  The microsecond count from TIME is ignored, and USECS is used instead.
143    If optional fourth argument DELTA is a positive number, make the timer
144  fire repeatedly that many seconds apart."  fire repeatedly that many seconds apart."
145    (or (timerp timer)    (or (timerp timer)
146        (error "Invalid timer"))        (error "Invalid timer"))
147    (aset timer 1 (car time))    (aset timer 1 (nth 0 time))
148    (aset timer 2 (if (consp (cdr time)) (car (cdr time)) (cdr time)))    (aset timer 2 (nth 1 time))
149    (aset timer 3 usecs)    (aset timer 3 usecs)
150    (aset timer 4 (and (numberp delta) (> delta 0) delta))    (aset timer 4 (and (numberp delta) (> delta 0) delta))
151    timer)    timer)
152    (make-obsolete 'timer-set-time-with-usecs
153                   "use `timer-set-time' and `timer-inc-time' instead."
154                   "21.4")
155    
156  (defun timer-set-function (timer function &optional args)  (defun timer-set-function (timer function &optional args)
157    "Make TIMER call FUNCTION with optional ARGS when triggering."    "Make TIMER call FUNCTION with optional ARGS when triggering."
# Line 257  TIME is a time-list." Line 261  TIME is a time-list."
261    (let ((high (- (car time) (aref timer 1)))    (let ((high (- (car time) (aref timer 1)))
262          (low (- (nth 1 time) (aref timer 2))))          (low (- (nth 1 time) (aref timer 2))))
263      (+ low (* high 65536))))      (+ low (* high 65536))))
264      
265  (defun timer-event-handler (timer)  (defun timer-event-handler (timer)
266    "Call the handler for the timer TIMER.    "Call the handler for the timer TIMER.
267  This function is called, by name, directly by the C code."  This function is called, by name, directly by the C code."

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.25.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26