« Back to Product

Documentation

IPS_GetTimer

 array IPS_GetTimer (int $TimerID) 

Parameters

TimerID

ID of the timer

Returns

The following information is available as key => value pairs:

Index Type Description
TimerID integer ID of the timer
InstanceID integer ID of the instance that registered the timer (1 for internal timers of the kernel)
Name string Name of the timer as given on registration
Interval integer Interval in milliseconds, 0 if the timer is disabled
LastRun integer Unix timestamp of the last execution, 0 if the timer has never been executed
NextRun integer Unix timestamp of the next scheduled execution, 0 if no execution is scheduled
Running boolean TRUE while the timer is being executed
RunOnce boolean TRUE for a one-time timer that removes itself after its execution

Description

The function returns information about the timer with the ID TimerID. If the timer does not exist, the function fails with "Timer #... does not exist".

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.

The next execution is scheduled after the previous one has finished, i.e. the interval counts from the end of the last execution.

IPS_GetTimerList returns the IDs of all timers, IPS_GetTimers returns the information of several timers at once.

Example

print_r(IPS_GetTimer(7));

/* e.g. returns:
Array
(
    [TimerID] => 7
    [InstanceID] => 12345
    [Name] => Update
    [Interval] => 60000
    [LastRun] => 1758880000
    [NextRun] => 1758880060
    [Running] =>
    [RunOnce] =>
)
*/
Any questions?