From 19d6e7a1f1a0ef5dcde45cc8c0d175129c73cfe1 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 31 Oct 2007 11:52:12 +0000 Subject: *** empty log message *** --- ev.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'ev.c') diff --git a/ev.c b/ev.c index a038613..96380ac 100644 --- a/ev.c +++ b/ev.c @@ -540,7 +540,7 @@ void ev_loop (int flags) if (timercnt) { - ev_tstamp to = timers [0]->at - get_clock () + method_fudge; + ev_tstamp to = timers [0]->at - (have_monotonic ? get_clock () : ev_now) + method_fudge; if (block > to) block = to; } @@ -679,9 +679,28 @@ evtimer_stop (struct ev_timer *w) downheap ((WT *)timers, timercnt, w->active - 1); } + w->at = w->repeat; + ev_stop ((W)w); } +void +evtimer_again (struct ev_timer *w) +{ + if (ev_is_active (w)) + { + if (w->repeat) + { + w->at = now + w->repeat; + downheap ((WT *)timers, timercnt, w->active - 1); + } + else + evtimer_stop (w); + } + else if (w->repeat) + evtimer_start (w); +} + void evperiodic_start (struct ev_periodic *w) { -- cgit v1.2.3