Ecore provides very flexible timer functionality.
The basic usage of timers is to call a certain function at a certain interval, which can be achieved with a single line:
If the function is to be executed only once simply return CORE_CALLBACK_CANCEL
instead.
Function Documentation
Creates a timer to call the given function in the given period of time.
This function adds a timer and returns its handle on success and NULL on failure. The function func
will be called every in
seconds. The function will be passed the data
pointer as its parameter.
- Since :
- 2.3
- Parameters:
-
[in] | in | The interval in seconds. |
[in] | func | The given function. If func returns 1, the timer is rescheduled for the next interval in . |
[in] | data | Data to pass to func when it is called. |
- Returns:
- A timer object on success.
NULL
on failure.
Deletes the specified timer from the timer list.
This deletes the specified timer from the set of timer that are executed during main loop execution. This function returns the data parameter that is being passed to the callback on success, otherwise NULL
on failure.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to delete |
- Returns:
- The data pointer set for the timer on add
Add some delay for the next occurrence of a timer.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to change. |
[in] | add | The delay to add to the next iteration. |
Dump the all timers.
- Since :
- 2.3
- Returns:
- The information of all timers
Pauses a running timer.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to be paused. |
- See also:
- ecore_timer_thaw()
Get the interval the timer ticks on.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to retrieve the interval from |
- Returns:
- The interval on success. -1 on failure.
Change the interval the timer ticks off.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to change. |
[in] | in | The interval in seconds. |
Creates a timer to call the given function in the given period of time.
- Since :
- 2.3
- Parameters:
-
[in] | in | The interval in seconds from the current loop time |
[in] | func | The given function
If func returns 1 , the timer is rescheduled for the next interval in. |
[in] | data | The data to pass to func when it is called |
- Returns:
- A timer object on success, otherwise
NULL
on failure
Get the pending time regarding a timer.
- Parameters:
-
- Returns:
- The pending time
- Since :
- 2.3
Retrieves the current precision used by timer infrastructure.
- Since :
- 2.3
- Returns:
- Current precision.
- See also:
- ecore_timer_precision_set()
Sets the precision to be used by timer infrastructure.
- Since :
- 2.3
- Parameters:
-
[in] | precision | difference from the requested internval. |
Reset a timer to its full interval. This effectively makes the timer start ticking off from zero now.
- Parameters:
-
- Since :
- 2.3
Resumes a frozen (paused) timer.
- Since :
- 2.3
- Parameters:
-
[in] | timer | The timer to be resumed. |
- See also:
- ecore_timer_freeze()