forked from enlightenment/efl
ecore/efl loop - use efl_loop_time_get on loop obj where needed
stop using the legacy ecore_loop_time_get() func when it should be coming from the loop object's loop time. also ecore_time_get should never fall back on ecore_loop_time_get for similar reasons. part of making the ecore/efl loop a non-global instance (allow loops in threads)
This commit is contained in:
parent
27ac9a2be2
commit
bfeded7252
|
@ -37,8 +37,7 @@ ecore_time_get(void)
|
|||
if (EINA_UNLIKELY(clock_gettime(_ecore_time_clock_id, &t)))
|
||||
{
|
||||
CRI("Cannot get current time");
|
||||
// Try to at least return the latest value retrieved
|
||||
return ecore_loop_time_get();
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
|
||||
|
|
|
@ -127,12 +127,13 @@ _efl_loop_timer_efl_object_constructor(Eo *obj, Efl_Loop_Timer_Data *timer)
|
|||
EOLIAN static Eo *
|
||||
_efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd)
|
||||
{
|
||||
if (pd->at < ecore_loop_time_get()) pd->at = ecore_time_get() + pd->in;
|
||||
else pd->at += pd->in;
|
||||
|
||||
pd->loop = efl_provider_find(obj, EFL_LOOP_CLASS);
|
||||
pd->loop_data = efl_data_scope_get(pd->loop, EFL_LOOP_CLASS);
|
||||
|
||||
if (pd->at < efl_loop_time_get(pd->loop))
|
||||
pd->at = ecore_time_get() + pd->in;
|
||||
else pd->at += pd->in;
|
||||
|
||||
if (pd->in < 0.0)
|
||||
{
|
||||
ERR("You need to specify the interval of a timer to create a valid timer.");
|
||||
|
@ -279,7 +280,7 @@ _efl_loop_timer_loop_reset(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer)
|
|||
// Do not reset the current timer while inside the callback
|
||||
if (timer->loop_data->timer_current == timer) return;
|
||||
|
||||
now = ecore_loop_time_get();
|
||||
now = efl_loop_time_get(timer->loop);
|
||||
if (!timer->initialized)
|
||||
{
|
||||
timer->at = now;
|
||||
|
@ -532,7 +533,7 @@ _efl_loop_timer_next_get(Eo *obj, Efl_Loop_Data *pd)
|
|||
if (!object) return -1;
|
||||
|
||||
first = _efl_loop_timer_after_get(efl_data_scope_get(object, MY_CLASS));
|
||||
now = ecore_loop_time_get();
|
||||
now = efl_loop_time_get(obj);
|
||||
in = first->at - now;
|
||||
if (in < 0) in = 0;
|
||||
return in;
|
||||
|
|
Loading…
Reference in New Issue