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 * ---------------------------------------------------
19 #include "inspircd_config.h"
21 #include <sys/resource.h>
22 #include <sys/types.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
35 #include "inspircd_io.h"
36 #include "inspstring.h"
37 #include "helperfuncs.h"
39 extern InspIRCd* ServerInstance;
40 extern ServerConfig* Config;
43 typedef std::vector<InspTimer*> timergroup;
44 typedef std::map<time_t, timergroup*> timerlist;
47 void TickTimers(time_t TIME)
49 timerlist::iterator found = Timers.find(TIME);
51 if (found != Timers.end())
53 log(DEBUG,"timer.cpp: There are timers to trigger");
54 timergroup* x = found->second;
56 * There are pending timers to trigger
58 for (timergroup::iterator y = x->begin(); y != x->end(); y++)
60 log(DEBUG,"timer.cpp: Triggering a timer");
61 InspTimer* n = (InspTimer*)*y;
63 log(DEBUG,"timer.cpp: TICK!");
67 log(DEBUG,"timer.cpp: Done triggering timers, tidying up");
73 void AddTimer(InspTimer* T)
75 log(DEBUG,"timer.cpp: Adding timer");
79 timerlist::iterator found = Timers.find(T->GetTimer());
81 if (found != Timers.end())
83 log(DEBUG,"timer.cpp: Add timer to existing group");
88 log(DEBUG,"timer.cpp: Add timer to new group");
90 Timers[T->GetTimer()] = x;