Documentation
IPS_GetTimers
array IPS_GetTimers (array $TimerIDs)
Parameters
| TimerIDs | Array with the IDs of the timers. If the array is empty, all timers are returned |
Returns
An array with one entry per timer in the order of TimerIDs. If TimerIDs is empty, the order of the entries is not guaranteed. Each entry has the same structure as in IPS_GetTimer.
Description
This function is intended for internal use only and may change or be removed at any time without notice.
The function returns the information of the timers with the IDs TimerIDs in one call. If TimerIDs is empty, all timers are returned. If one of the timers does not exist, the function fails with "Timer #... does not exist".
The function is intended to be called through the JSON-RPC interface, e.g. for the display in the console. It is not available in PHP scripts ("This function is not available for PHP") – there the result can be determined with IPS_GetTimerList and IPS_GetTimer.
Timers are registered by instances, e.g. by PHP modules with RegisterTimer and SetTimerInterval or as one-time timers with RegisterOnceTimer. The built-in modules use timers as well, e.g. "SearchExpires" for the end of the search mode. The TimerIDs are assigned at runtime and are not persistent, one-time timers disappear after their execution. Script timers (IPS_SetScriptTimer) are cyclic events and do not belong to these timers.
Example
// Show all timers of an instance via the JSON-RPC interface
$rpc = new JSONRPC("http://user:password@127.0.0.1:3777/api/");
foreach ($rpc->IPS_GetTimers([]) as $timer) {
if ($timer['InstanceID'] == 12345) {
printf("%s: %d ms, next run: %s\n", $timer['Name'], $timer['Interval'], $timer['NextRun'] ? date('H:i:s', $timer['NextRun']) : '-');
}
}
/* e.g. returns:
Update: 60000 ms, next run: 12:01:00
*/