InspIRCd
2.0
|
#include <timer.h>
Public Member Functions | |
Timer (long secs_from_now, time_t now, bool repeating=false) | |
virtual | ~Timer () |
virtual time_t | GetTimer () |
virtual void | SetTimer (time_t t) |
virtual void | Tick (time_t TIME)=0 |
bool | GetRepeat () |
long | GetSecs () |
void | CancelRepeat () |
Timer class for one-second resolution timers Timer provides a facility which allows module developers to create one-shot timers. The timer can be made to trigger at any time up to a one-second resolution. To use Timer, inherit a class from Timer, then insert your inherited class into the queue using Server::AddTimer(). The Tick() method of your object (which you should override) will be called at the given time.
|
inline |
Default constructor, initializes the triggering time
secs_from_now | The number of seconds from now to trigger the timer |
now | The time now |
repeating | Repeat this timer every secs_from_now seconds if set to true |
|
inlinevirtual |
Default destructor, does nothing.
|
inline |
Cancels the repeat state of a repeating timer. If you call this method, then the next time your timer ticks, it will be removed immediately after. You should use this method call to remove a recurring timer if you wish to do so within the timer's Tick event, as calling TimerManager::DelTimer() from within the Timer::Tick() method is dangerous and may cause a segmentation fault. Calling CancelRepeat() is safe in this case.
|
inline |
Returns true if this timer is set to repeat
|
inline |
Returns the interval (number of seconds between ticks) of this timer object.
|
inlinevirtual |
Retrieve the current triggering time
|
inlinevirtual |
Sets the trigger timeout to a new value
|
pure virtual |
Called when the timer ticks. You should override this method with some useful code to handle the tick event.
Implemented in RequestTimeout, CacheTimer, and SocketTimeout.