aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/examples/ecore_time_functions_example.c
blob: 5fa5d6091dabdac0210998699a368ebd77ae1b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Ecore.h>
#include <unistd.h>

static Eina_Bool
_timer_cb(void *data)
{
   printf("ecore time: %0.3f\n", ecore_time_get());
   printf("loop time: %0.3f\n", ecore_loop_time_get());
   printf("unix time: %0.3f\n", ecore_time_unix_get());
   printf("\nSleep for 1 second...\n\n");
   sleep(1);
   printf("ecore time: %0.3f\n", ecore_time_get());
   printf("loop time: %0.3f\n", ecore_loop_time_get());
   printf("unix time: %0.3f\n", ecore_time_unix_get());

   ecore_main_loop_quit();

   return EINA_FALSE;
}

int main(int argc, char **argv)
{
   if (!ecore_init())
     {
	printf("ERROR: Cannot init Ecore!\n");
	return -1;
     }

   ecore_timer_add(0.1, _timer_cb, NULL);
   ecore_main_loop_begin();
   ecore_shutdown();
}