diff options
| author | 2026-07-10 11:15:52 +0100 | |
|---|---|---|
| committer | 2026-07-10 11:58:06 +0100 | |
| commit | 5f9c2b3c97ed1eeb19270fd3582b71ca8e1ca1ac (patch) | |
| tree | a6d3d38e04f30b0906141f49d4e0fd643be1d0d9 /src/timer.cpp | |
| parent | Convert TLS::IOHook::Status to an enum class. (diff) | |
Use saturating adds/subtracts when handling timestamps.
Diffstat (limited to 'src/timer.cpp')
| -rw-r--r-- | src/timer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/timer.cpp b/src/timer.cpp index 6906218bb..308f36694 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -26,6 +26,7 @@ #include "inspircd.h" +#include "timeutils.h" void Timer::SetInterval(unsigned long newinterval, bool restart) { @@ -34,7 +35,7 @@ void Timer::SetInterval(unsigned long newinterval, bool restart) return; ServerInstance->Timers.DelTimer(this); - SetTrigger(ServerInstance->Time() + newinterval); + SetTrigger(Time::In(newinterval)); ServerInstance->Timers.AddTimer(this); } @@ -89,7 +90,7 @@ void TimerManager::DelTimer(Timer* t) void TimerManager::AddTimer(Timer* t) { - time_t trigger = ServerInstance->Time() + t->GetInterval(); + const auto trigger = Time::In(t->GetInterval()); t->SetTrigger(trigger); Timers.emplace(trigger, t); } |
