]> git.llucax.com Git - software/libev.git/blobdiff - ev.c
make timers best-effort non-drifting
[software/libev.git] / 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.));
-          ((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