summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorroot <root>2008-05-21 12:51:38 +0000
committerroot <root>2008-05-21 12:51:38 +0000
commit5582a72fb6e8f506495c10726016938306ecb6da (patch)
treeeb6dcf4955137642a6ede2e80e3edf6b1a0933a5 /ev.c
parent4882be2755ec7953a6d136cc182ccb55ce71f2f3 (diff)
*** empty log message ***
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ev.c b/ev.c
index 352c3f1..fc4f443 100644
--- a/ev.c
+++ b/ev.c
@@ -1651,9 +1651,18 @@ periodics_reify (EV_P)
else if (w->interval)
{
ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
- if (ev_at (w) - ev_rt_now <= TIME_EPSILON) ev_at (w) += w->interval;
+ /* if next trigger time is not sufficiently in the future, put it there */
+ /* this might happen because of floating point inexactness */
+ if (ev_at (w) - ev_rt_now < TIME_EPSILON)
+ {
+ ev_at (w) += w->interval;
- assert (("ev_periodic timeout in the past detected while processing timers, negative interval?", ev_at (w) >= ev_rt_now));
+ /* if interval is unreasonably low we might still have a time in the past */
+ /* so correct this. this will make the periodic very inexact, but the user */
+ /* has effectively asked to get triggered more often than possible */
+ if (ev_at (w) < ev_rt_now)
+ ev_at (w) = ev_rt_now;
+ }
ANHE_at_set (periodics [HEAP0]);
downheap (periodics, periodiccnt, HEAP0);