1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #ifndef INSPIRCD_TIMER_H
18 #define INSPIRCD_TIMER_H
20 /** Timer class for one-second resolution timers
21 * InspTimer provides a facility which allows module
22 * developers to create one-shot timers. The timer
23 * can be made to trigger at any time up to a one-second
24 * resolution. To use InspTimer, inherit a class from
25 * InspTimer, then insert your inherited class into the
26 * queue using Server::AddTimer(). The Tick() method of
27 * your object (which you should override) will be called
30 class InspTimer : public Extensible
33 /** The triggering time
37 /** Default constructor, initializes the triggering time
39 InspTimer(long secs_from_now,time_t now)
41 trigger = now + secs_from_now;
43 /** Default destructor, does nothing.
45 virtual ~InspTimer() { }
46 /** Retrieve the current triggering time
48 virtual time_t GetTimer()
52 /** Called when the timer ticks.
54 virtual void Tick(time_t TIME) = 0;
57 void TickTimers(time_t TIME);
58 void AddTimer(InspTimer* T);
59 void TickMissedTimers(time_t TIME);