Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
ecore_timer.c
Log Message:
This patch add the possibility to delay a timer and to know the
pending time before the next wake up.
They should not affect any current code using the timer.
--
Cedric BAIL
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_timer.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ecore_timer.c 9 Mar 2008 15:56:17 -0000 1.19
+++ ecore_timer.c 11 Apr 2008 23:39:55 -0000 1.20
@@ -97,7 +97,61 @@
}
/**
- *
+ * Add some delay for the next occurence of a timer.
+ * This doesn't affect the interval of a timer.
+ *
+ * @param timer The timer to change.
+ * @param add The dalay to add to the next iteration.
+ * @ingroup Ecore_Time_Group
+ */
+EAPI void
+ecore_timer_delay(Ecore_Timer *timer, double add)
+{
+ if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
+ {
+ ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
+ "ecore_timer_delay");
+ return;
+ }
+
+ if (timer->frozen)
+ {
+ timer->pending += add;
+ }
+ else
+ {
+ timers = _ecore_list2_remove(timers, timer);
+ _ecore_timer_set(timer, timer->at + add, timer->in, timer->func,
timer->data);
+ }
+}
+
+/**
+ * Get the pending time regarding a timer.
+ *
+ * @param timer The timer to learn from.
+ * @ingroup Ecore_Time_Group
+ */
+EAPI double
+ecore_timer_pending_get(Ecore_Timer *timer)
+{
+ double now;
+
+ if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
+ {
+ ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
+ "ecore_timer_pending_get");
+ return 0;
+ }
+
+ now = ecore_time_get();
+
+ if (timer->frozen)
+ return timer->pending;
+ return timer->at - now;
+}
+
+/**
+ *
*
*/
EAPI void
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs