Hello Libev,

  I was need to know how many time remain before fire in the timer, so
  I wrote a small patch. I would like libev to have this functionality
  in the future releases ;)

-- 
Best regards,
 Denis                          mailto:[email protected]
diff -ru libev-3.6/ev.c libev-3.6.remain/ev.c
--- libev-3.6/ev.c      2009-04-25 21:10:27.000000000 +0700
+++ libev-3.6.remain/ev.c       2009-06-08 18:43:30.000000000 +0700
@@ -2380,6 +2380,12 @@
   EV_FREQUENT_CHECK;
 }
 
+void noinline
+ev_timer_remain (EV_P_ ev_timer *w)
+{
+    return ev_at (w) - mn_now;
+}
+
 #if EV_PERIODIC_ENABLE
 void noinline
 ev_periodic_start (EV_P_ ev_periodic *w)
diff -ru libev-3.6/ev.h libev-3.6.remain/ev.h
--- libev-3.6/ev.h      2009-04-25 19:36:47.000000000 +0700
+++ libev-3.6.remain/ev.h       2009-06-08 18:41:57.000000000 +0700
@@ -610,6 +610,7 @@
 void ev_timer_stop     (EV_P_ ev_timer *w);
 /* stops if active and no repeat, restarts if active and repeating, starts if 
inactive and repeating */
 void ev_timer_again    (EV_P_ ev_timer *w);
+ev_tstamp ev_timer_remain (EV_P_ ev_timer *w);
 
 #if EV_PERIODIC_ENABLE
 void ev_periodic_start (EV_P_ ev_periodic *w);
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to