summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-27 01:40:07 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-12-27 01:40:07 +0900
commitbfeded72526b4a5c37a93027ad0e9733bb20f745 (patch)
tree1e168375fcaeb1a3c3655a805b0bbef3715130b7
parent27ac9a2be294f1e4f7ab9a6483e51d8eaaa3f440 (diff)
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)
-rw-r--r--src/lib/ecore/ecore_time.c3
-rw-r--r--src/lib/ecore/ecore_timer.c11
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)
37 if (EINA_UNLIKELY(clock_gettime(_ecore_time_clock_id, &t))) 37 if (EINA_UNLIKELY(clock_gettime(_ecore_time_clock_id, &t)))
38 { 38 {
39 CRI("Cannot get current time"); 39 CRI("Cannot get current time");
40 // Try to at least return the latest value retrieved 40 return 0.0;
41 return ecore_loop_time_get();
42 } 41 }
43 42
44 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); 43 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)
127EOLIAN static Eo * 127EOLIAN static Eo *
128_efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd) 128_efl_loop_timer_efl_object_finalize(Eo *obj, Efl_Loop_Timer_Data *pd)
129{ 129{
130 if (pd->at < ecore_loop_time_get()) pd->at = ecore_time_get() + pd->in;
131 else pd->at += pd->in;
132
133 pd->loop = efl_provider_find(obj, EFL_LOOP_CLASS); 130 pd->loop = efl_provider_find(obj, EFL_LOOP_CLASS);
134 pd->loop_data = efl_data_scope_get(pd->loop, EFL_LOOP_CLASS); 131 pd->loop_data = efl_data_scope_get(pd->loop, EFL_LOOP_CLASS);
135 132
133 if (pd->at < efl_loop_time_get(pd->loop))
134 pd->at = ecore_time_get() + pd->in;
135 else pd->at += pd->in;
136
136 if (pd->in < 0.0) 137 if (pd->in < 0.0)
137 { 138 {
138 ERR("You need to specify the interval of a timer to create a valid timer."); 139 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)
279 // Do not reset the current timer while inside the callback 280 // Do not reset the current timer while inside the callback
280 if (timer->loop_data->timer_current == timer) return; 281 if (timer->loop_data->timer_current == timer) return;
281 282
282 now = ecore_loop_time_get(); 283 now = efl_loop_time_get(timer->loop);
283 if (!timer->initialized) 284 if (!timer->initialized)
284 { 285 {
285 timer->at = now; 286 timer->at = now;
@@ -532,7 +533,7 @@ _efl_loop_timer_next_get(Eo *obj, Efl_Loop_Data *pd)
532 if (!object) return -1; 533 if (!object) return -1;
533 534
534 first = _efl_loop_timer_after_get(efl_data_scope_get(object, MY_CLASS)); 535 first = _efl_loop_timer_after_get(efl_data_scope_get(object, MY_CLASS));
535 now = ecore_loop_time_get(); 536 now = efl_loop_time_get(obj);
536 in = first->at - now; 537 in = first->at - now;
537 if (in < 0) in = 0; 538 if (in < 0) in = 0;
538 return in; 539 return in;