Enlightenment CVS committal Author : raster Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore Modified Files: ecore_timer.c Log Message: slaten's timer patch :) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_timer.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ecore_timer.c 22 Feb 2005 12:39:50 -0000 1.11 +++ ecore_timer.c 4 Apr 2005 16:01:39 -0000 1.12 @@ -6,6 +6,7 @@ static int timers_added = 0; static int timers_delete_me = 0; static Ecore_Timer *timers = NULL; +static double last_check = 0.0; /** * @defgroup Ecore_Time_Group Ecore Time Functions @@ -155,6 +156,16 @@ Ecore_Timer *timer; if (!timers) return 0; + if (last_check > when) + { + /* User set time backwards */ + for (l = (Ecore_Oldlist *)timers; l; l = l->next) + { + timer = (Ecore_Timer *)l; + timer->at -= (last_check - when); + } + } + last_check = when; for (l = (Ecore_Oldlist *)timers; l; l = l->next) { timer = (Ecore_Timer *)l; @@ -165,7 +176,16 @@ timers = _ecore_list_remove(timers, timer); _ecore_timer_call(when); if ((!timer->delete_me) && (timer->func(timer->data))) - _ecore_timer_set(timer, timer->at + timer->in, timer->in, timer->func, timer->data); + { + /* if the timer would have gone off more than 30 seconds ago, + * assume that the system hung and set the timer to go off + * timer->in from now. + */ + if ((timer->at + timer->in) < (when - 30.0)) + _ecore_timer_set(timer, when + timer->in, timer->in, timer->func, timer->data); + else + _ecore_timer_set(timer, timer->at + timer->in, timer->in, timer->func, timer->data); + } else free(timer); return 1; ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs