summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2007-12-11 15:06:50 +0000
committerroot <root>2007-12-11 15:06:50 +0000
commitecc32f357000f3122b62992d755b4ce8156ab168 (patch)
treef6a1c86d0f13252a685676927897fb802a639c52
parentae1704c5ed25ba151cb448264ada4b96c9b88225 (diff)
*** empty log message ***
-rw-r--r--ev.c7
1 files changed, 3 insertions, 4 deletions
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;