raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=bfeded72526b4a5c37a93027ad0e9733bb20f745

commit bfeded72526b4a5c37a93027ad0e9733bb20f745
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Wed Dec 27 01:40:07 2017 +0900

    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)
---
 src/lib/ecore/ecore_time.c  |  3 +--
 src/lib/ecore/ecore_timer.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lib/ecore/ecore_time.c b/src/lib/ecore/ecore_time.c
index e96e80a9f5..c7c79b1ad5 100644
--- a/src/lib/ecore/ecore_time.c
+++ b/src/lib/ecore/ecore_time.c
@@ -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);
diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c
index 106544558b..0ec3592643 100644
--- a/src/lib/ecore/ecore_timer.c
+++ b/src/lib/ecore/ecore_timer.c
@@ -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;

-- 


Reply via email to