X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Ftimer.cpp;h=a79105f5292d23e5ce6599619c703897f1990461;hb=4cc6e5e14fdbde499481dbab5ab2ad1257b8af9c;hp=ab0e9456c75f24f9001a27094e7ed496f567cf95;hpb=6cace9502f5a7e9cb9e924e1ef3483021c6a4e28;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/timer.cpp b/src/timer.cpp index ab0e9456c..a79105f52 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -14,7 +14,7 @@ #include "inspircd.h" #include "timer.h" -TimerManager::TimerManager() : CantDeleteHere(false) +TimerManager::TimerManager(InspIRCd* Instance) : CantDeleteHere(false), ServerInstance(Instance) { } @@ -33,7 +33,7 @@ void TimerManager::TickTimers(time_t TIME) */ for (timergroup::iterator y = x->begin(); y != x->end(); y++) { - InspTimer* n = *y; + Timer* n = *y; n->Tick(TIME); if (n->GetRepeat()) { @@ -52,7 +52,7 @@ void TimerManager::TickTimers(time_t TIME) this->CantDeleteHere = false; } -void TimerManager::DelTimer(InspTimer* T) +void TimerManager::DelTimer(Timer* T) { if (this->CantDeleteHere) { @@ -79,7 +79,7 @@ void TimerManager::DelTimer(InspTimer* T) timergroup* x = found->second; for (timergroup::iterator y = x->begin(); y != x->end(); y++) { - InspTimer* n = *y; + Timer* n = *y; if (n == T) { DELETE(n); @@ -104,39 +104,11 @@ void TimerManager::DelTimer(InspTimer* T) */ void TimerManager::TickMissedTimers(time_t TIME) { - /** See comment above in TickTimers - */ - this->CantDeleteHere = true; - for (time_t n = TIME-1; n > TIME-120; n--) - { - timerlist::iterator found = Timers.find(n); - if (found != Timers.end()) - { - timergroup* x = found->second; - for (timergroup::iterator y = x->begin(); y != x->end(); y++) - { - InspTimer* z = *y; - z->Tick(TIME); - if (z->GetRepeat()) - { - AddTimer(z, z->GetSecs()); - } - else - { - DELETE(z); - } - } - - Timers.erase(found); - DELETE(x); - } - } - - this->CantDeleteHere = false; + this->TickTimers(TIME); } -void TimerManager::AddTimer(InspTimer* T, long secs_from_now) +void TimerManager::AddTimer(Timer* T, long secs_from_now) { timergroup* x = NULL; @@ -144,7 +116,7 @@ void TimerManager::AddTimer(InspTimer* T, long secs_from_now) if (!secs_from_now) time_to_trigger = T->GetTimer(); else - time_to_trigger = secs_from_now + time(NULL); + time_to_trigger = secs_from_now + ServerInstance->Time(); timerlist::iterator found = Timers.find(time_to_trigger);