Tizen Native API
ecore_time - Differences between time functions

This example shows the difference between calling ecore_time_get(), ecore_loop_time_get() and ecore_time_unix_get().

It initializes ecore, then sets a timer with a callback that, when called, will retrieve the system time using these 3 different functions. After displaying the time, it sleeps for 1 second, then call display the time again using the 3 functions.

Since everything occurs inside the same main loop iteration, the internal ecore time variable will not be updated, and calling ecore_loop_time_get() before and after the sleep() call will return the same result.

The two other functions will return a difference of 1 second, as expected. But ecore_time_unix_get() returns the number of seconds since 00:00:00 1st January 1970, while ecore_time_get() will return the time since a unspecified point, but that never goes back in time, even when the timezone of the machine changes.

The usage of ecore_loop_time_get() should be preferred against the two other functions, for most time calculations, since it won't produce a system call to get the current time. Use ecore_time_unix_get() when you need to know the current time and date, and ecore_time_get() when you need a monotonic and more precise time than ecore_loop_time_get().