>>>> "nix" == nix
<nix(a)esperi.demon.co.uk> writes:
nix> Yes, packages really do pass negative times to
nix> `timer-set-time' --- normally because they tried to
nix> `run-at-time' `now' and the second changed at the wrong
nix> instant. We should try to do what is asked, rather than
nix> falling over. (What does FSF do in this situation?)
What a coincidence, Nix!
I was having this same problem while debugging battery.el for someone
else. Stepping thru the code will definitely create negative numbers
:-)
Adrian
nix> Perhaps setting the timer to zero seconds rather than one would be
nix> better, but I'm not sure if that works.
nix> 2002-03-24 Nix <nix(a)esperi.demon.co.uk>
nix> * timer.el (timer-set-time): Handle timers starting in the past.
nix> Index: packages/xemacs-packages/fsf-compat/timer.el
nix> ===================================================================
nix> RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/fsf-compat/timer.el,v
nix> retrieving revision 1.2
nix> diff -u -r1.2 timer.el
nix> --- packages/xemacs-packages/fsf-compat/timer.el 2002/01/22 14:22:59 1.2
nix> +++ packages/xemacs-packages/fsf-compat/timer.el 2002/03/24 00:36:45
nix> @@ -45,7 +45,10 @@
nix> TIME must be in the internal format returned by, e.g., `current-time'.
nix> If optional third argument DELTA is a non-zero integer, make the timer
nix> fire repeatedly that many seconds apart."
nix> - (set-itimer-value timer (itimer-time-difference time (current-time)))
nix> + (let ((timer-when (itimer-time-difference time (current-time))))
nix> + (or (> timer-when 0)
nix> + (setq timer-when 1))
nix> + (set-itimer-value timer timer-when))
nix> (and delta (check-nonnegative-number delta))
nix> (and delta (set-itimer-restart timer delta))
nix> timer)
nix> --
nix> `Oh, I seeeee, good light; bad light. Presumably the bad light is
nix> different -- perhaps it's a sawtooth waveform, and the pointy bits
nix> scratch your eyes?' --- John Ineson to a `monitors emit radiation,
nix> all radiation is bad, therefore monitors are bad' tub-thumper
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/