]> git.llucax.com Git - software/libev.git/commitdiff
make timers best-effort non-drifting
authorroot <root>
Sun, 11 Nov 2007 00:05:59 +0000 (00:05 +0000)
committerroot <root>
Sun, 11 Nov 2007 00:05:59 +0000 (00:05 +0000)
ev.c

diff --git a/ev.c b/ev.c
index 28ed91b2ac61771d97f8f229f668b72594e7c46a..a605a57ba6c520032cf7d0810936dc3d3ae44ef3 100644 (file)
--- a/ev.c
+++ b/ev.c
@@ -989,7 +989,11 @@ timers_reify (EV_P)
       if (w->repeat)
         {
           assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.));
       if (w->repeat)
         {
           assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.));
-          ((WT)w)->at = mn_now + w->repeat;
+
+          ((WT)w)->at += w->repeat;
+          if (((WT)w)->at < mn_now)
+            ((WT)w)->at = mn_now;
+
           downheap ((WT *)timers, timercnt, 0);
         }
       else
           downheap ((WT *)timers, timercnt, 0);
         }
       else