[PATCH] Make start-itimer punctual (Re: run-at-time capricious)
Michael D. Harnois
mharnois at cpinternet.com
Thu Sep 16 08:33:35 EDT 2004
Was there a reason this patch didn't go into 21.5?
> APPROVE COMMIT 21.4
> Thanks for the patch - it will appear in 21.4.15.
> - Vin
> Katsumi Yamaoka <yamaoka at jpl.org> writes:
>> I read itimer.el thoroughly and made a patch fixing the bug on
>> which start-itimer does not work as the value specified by the
>> first argument TIME when other timers are running. This bug is
>> brought about because the difference of the present time and the
>> time when the itimer driver was woken up will be subtracted from
>> the specified value TIME. I solved it by adding the difference
>> to TIME beforehand. It is helpful to run-at-time as well.
>> Don't forget to load itimer.elc when you test it. :)
>> 2003-12-12 Katsumi Yamaoka <yamaoka at jpl.org>
>> * itimer.el (activate-itimer): Modify the itimer timeout value as
>> if it were begun at the last time when the itimer driver was woken
>> --- itimer.el~ 2001-04-12 18:21:28 +0000
>> +++ itimer.el 2003-12-12 00:43:13 +0000
>> @@ -406,6 +406,14 @@
>> (error "itimer named \"%s\" already existing and activated"
>> (itimer-name itimer))))
>> (let ((inhibit-quit t))
>> + (if itimer-timer
>> + ;; Modify the itimer timeout value as if it were begun
>> + ;; at the last time when the itimer driver was woken up.
>> + (set-itimer-value
>> + itimer
>> + (+ (itimer-value itimer)
>> + (itimer-time-difference (current-time)
>> + itimer-timer-last-wakeup))))
>> ;; add the itimer to the global list
>> (setq itimer-list (cons itimer itimer-list))
>> ;; If the itimer process is scheduled to wake up too late for
Michael D. Harnois
Done preparing for the bar in Hugo, Minnesota
A foolish consistency is the hobgoblin of little minds.
-- Ralph Waldo Emerson
More information about the XEmacs-Beta