From: root Date: Tue, 11 Dec 2007 15:06:50 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: rel-1_8~2 X-Git-Url: https://git.llucax.com/software/libev.git/commitdiff_plain/ecc32f357000f3122b62992d755b4ce8156ab168?ds=inline *** empty log message *** --- diff --git a/ev.c b/ev.c index f7aab9c..f53e8ff 100644 --- a/ev.c +++ b/ev.c @@ -223,8 +223,7 @@ extern "C" { * It is added to ev_rt_now when scheduling periodics * to ensure progress, time-wise, even when rounding * errors are against us. - * This value is good at least till the year 4000 - * and intervals up to 20 years. + * This value is good at least till the year 4000. * Better solutions welcome. */ #define TIME_EPSILON 0.0001220703125 /* 1/8192 */ @@ -1250,7 +1249,8 @@ periodics_reify (EV_P) } else if (w->interval) { - ((WT)w)->at = w->offset + floor ((ev_rt_now + TIME_EPSILON - w->offset) / w->interval + 1.) * w->interval; + ((WT)w)->at = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval; + if (((WT)w)->at - ev_rt_now <= TIME_EPSILON) ((WT)w)->at += w->interval; assert (("ev_periodic timeout in the past detected while processing timers, negative interval?", ((WT)w)->at > ev_rt_now)); downheap ((WT *)periodics, periodiccnt, 0); } @@ -1373,7 +1373,6 @@ time_update (EV_P) #if EV_PERIODIC_ENABLE periodics_reschedule (EV_A); #endif - /* adjust timers. this is easy, as the offset is the same for all of them */ for (i = 0; i < timercnt; ++i) ((WT)timers [i])->at += ev_rt_now - mn_now;