1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 11:33:12 +02:00

Change Timer::Tick to return bool, get rid of the repeating field.

This commit is contained in:
Sadie Powell
2026-05-02 14:34:17 +01:00
parent c0bafe10b4
commit f12b590a6d
15 changed files with 52 additions and 53 deletions
+3 -12
View File
@@ -17,20 +17,18 @@
std::multimap<time_t, Timer *> TimerManager::Timers;
Timer::Timer(time_t time_from_now, bool repeating)
Timer::Timer(time_t time_from_now)
: trigger(Anope::CurTime + std::abs(time_from_now))
, secs(time_from_now)
, repeat(repeating)
{
if (time_from_now)
TimerManager::AddTimer(this);
}
Timer::Timer(Module *creator, time_t time_from_now, bool repeating)
Timer::Timer(Module *creator, time_t time_from_now)
: owner(creator)
, trigger(Anope::CurTime + std::abs(time_from_now))
, secs(time_from_now)
, repeat(repeating)
{
if (time_from_now)
TimerManager::AddTimer(this);
@@ -53,11 +51,6 @@ time_t Timer::GetTimer() const
return trigger;
}
bool Timer::GetRepeat() const
{
return repeat;
}
void Timer::SetSecs(time_t t)
{
TimerManager::DelTimer(this);
@@ -104,9 +97,7 @@ void TimerManager::TickTimers()
if (t->GetTimer() > Anope::CurTime)
break;
t->Tick();
if (t->GetRepeat())
if (t->Tick())
t->SetTimer(Anope::CurTime + t->GetSecs());
else
delete t;