On Thu, 26 Nov 2020 10:10:29 +0800 (CST) Jing <chenjing...@126.com> said:

Timers are working fine as far as i can see. a repeat timer every 0.5 sec and
some other ones to go off at 1.0, 2.0, 3.5, 5.0, 10.0, 20.0, 30.0, and 60.0 sec
from the start of the app running... i don't see your issue.

// gcc t.c -o t `pkg-config --cflags --libs ecore`
#include <Ecore.h>

double t0;

Eina_Bool _cb_rep(void *data) {
   printf("repeat -> @ %1.5f\n", ecore_time_get() - t0);
   return EINA_TRUE;
}

Eina_Bool _cb_tm(void *data) {
   printf("timer @ %1.5f\n", ecore_time_get() - t0);
   return EINA_FALSE;
}

int main(int argc, char **argv) {
   ecore_init();
   t0 = ecore_time_get();
   ecore_timer_add(0.5, _cb_rep, NULL);
   ecore_timer_add(1.0, _cb_tm, NULL);
   ecore_timer_add(2.0, _cb_tm, NULL);
   ecore_timer_add(2.5, _cb_tm, NULL);
   ecore_timer_add(5.0, _cb_tm, NULL);
   ecore_timer_add(10.0, _cb_tm, NULL);
   ecore_timer_add(20.0, _cb_tm, NULL);
   ecore_timer_add(30.0, _cb_tm, NULL);
   ecore_timer_add(60.0, _cb_tm, NULL);
   ecore_main_loop_begin();
   ecore_shutdown();
}

running it:

 5:24PM ~ > ./t
repeat -> @ 0.50281
repeat -> @ 1.00252
timer @ 1.00253
repeat -> @ 1.50279
repeat -> @ 2.00252
timer @ 2.00253
repeat -> @ 2.50275
timer @ 2.50277
repeat -> @ 3.00255
repeat -> @ 3.50256
repeat -> @ 4.00252
repeat -> @ 4.50276
repeat -> @ 5.00252
timer @ 5.00253
repeat -> @ 5.50280
repeat -> @ 6.00265
repeat -> @ 6.50283
repeat -> @ 7.00277
repeat -> @ 7.50261
repeat -> @ 8.00261
repeat -> @ 8.50254
repeat -> @ 9.00284
repeat -> @ 9.50281
repeat -> @ 10.00282
timer @ 10.00284
repeat -> @ 10.50277
repeat -> @ 11.00256
repeat -> @ 11.50276
repeat -> @ 12.00151
repeat -> @ 12.50067
repeat -> @ 13.00279
repeat -> @ 13.50255
repeat -> @ 14.00280
repeat -> @ 14.50280
repeat -> @ 15.00277
repeat -> @ 15.50282
repeat -> @ 16.00281
repeat -> @ 16.50281
repeat -> @ 17.00257
repeat -> @ 17.50281
repeat -> @ 18.00280
repeat -> @ 18.50264
repeat -> @ 19.00269
repeat -> @ 19.50158
repeat -> @ 20.00279
timer @ 20.00281
repeat -> @ 20.50271
repeat -> @ 21.00256
repeat -> @ 21.50040
repeat -> @ 22.00265
repeat -> @ 22.50266
repeat -> @ 23.00271
repeat -> @ 23.50262
repeat -> @ 24.00265
repeat -> @ 24.50273
repeat -> @ 25.00281
repeat -> @ 25.50279
repeat -> @ 26.00259
repeat -> @ 26.50253
repeat -> @ 27.00278
repeat -> @ 27.50281
repeat -> @ 28.00259
repeat -> @ 28.50280
repeat -> @ 29.00280
repeat -> @ 29.50281
repeat -> @ 30.00266
timer @ 30.00268
repeat -> @ 30.50280
repeat -> @ 31.00281
repeat -> @ 31.50281
repeat -> @ 32.00281
repeat -> @ 32.50276
repeat -> @ 33.00281
repeat -> @ 33.50282
repeat -> @ 34.00271
repeat -> @ 34.50277
repeat -> @ 35.00279
repeat -> @ 35.50278
repeat -> @ 36.00281
repeat -> @ 36.50275
repeat -> @ 37.00281
repeat -> @ 37.50282
repeat -> @ 38.00252
repeat -> @ 38.50279
repeat -> @ 39.00063
repeat -> @ 39.50279
repeat -> @ 40.00279
repeat -> @ 40.50281
repeat -> @ 41.00277
repeat -> @ 41.50273
repeat -> @ 42.00275
repeat -> @ 42.50176
repeat -> @ 43.00274
repeat -> @ 43.50271
repeat -> @ 44.00282
repeat -> @ 44.50282
repeat -> @ 45.00280
repeat -> @ 45.50278
repeat -> @ 46.00281
repeat -> @ 46.50277
repeat -> @ 47.00282
repeat -> @ 47.50280
repeat -> @ 48.00282
repeat -> @ 48.50281
repeat -> @ 49.00208
repeat -> @ 49.50277
repeat -> @ 50.00279
repeat -> @ 50.50281
repeat -> @ 51.00279
repeat -> @ 51.50255
repeat -> @ 52.00280
repeat -> @ 52.50274
repeat -> @ 53.00256
repeat -> @ 53.50278
repeat -> @ 54.00281
repeat -> @ 54.50279
repeat -> @ 55.00277
repeat -> @ 55.50281
repeat -> @ 56.00281
repeat -> @ 56.50263
repeat -> @ 57.00263
repeat -> @ 57.50277
repeat -> @ 58.00279
repeat -> @ 58.50281
repeat -> @ 59.00281
repeat -> @ 59.50278
repeat -> @ 60.00281
timer @ 60.00282
repeat -> @ 60.50280
repeat -> @ 61.00255
repeat -> @ 61.50253


> Hi all,
> I use ecore_timer_add to create a 30-second timer, but the callback is
> triggered before the time is up. For example, the callback is triggered in 20
> seconds. Why does this happen? Please help, thanks.
> _______________________________________________ enlightenment-devel mailing
> list enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - ras...@rasterman.com



_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to