Tizen 2.1 base
[framework/uifw/ecore.git] / src / examples / ecore_time_functions_example.c
1 #include <Ecore.h>
2 #include <unistd.h>
3
4 static Eina_Bool
5 _timer_cb(void *data)
6 {
7    printf("ecore time: %0.3f\n", ecore_time_get());
8    printf("loop time: %0.3f\n", ecore_loop_time_get());
9    printf("unix time: %0.3f\n", ecore_time_unix_get());
10    printf("\nSleep for 1 second...\n\n");
11    sleep(1);
12    printf("ecore time: %0.3f\n", ecore_time_get());
13    printf("loop time: %0.3f\n", ecore_loop_time_get());
14    printf("unix time: %0.3f\n", ecore_time_unix_get());
15
16    ecore_main_loop_quit();
17
18    return EINA_FALSE;
19 }
20
21 int
22 main(int argc, char **argv)
23 {
24    if (!ecore_init())
25      {
26         printf("ERROR: Cannot init Ecore!\n");
27         return -1;
28      }
29
30    ecore_timer_add(0.1, _timer_cb, NULL);
31    ecore_main_loop_begin();
32    ecore_shutdown();
33 }
34