From 5f9c2b3c97ed1eeb19270fd3582b71ca8e1ca1ac Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 10 Jul 2026 11:15:52 +0100 Subject: Use saturating adds/subtracts when handling timestamps. --- src/usermanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/usermanager.cpp') diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 861085636..dedb4add0 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -65,14 +65,14 @@ namespace // This user didn't answer the last ping, remove them. if (!user->lastping) { - time_t secs = ServerInstance->Time() - (user->nextping - user->GetClass()->pingtime); + const auto secs = Time::Ago(user->nextping - user->GetClass()->pingtime); const std::string message = FMT::format("Ping timeout: {}", Duration::ToLongString(secs)); ServerInstance->Users.QuitUser(user, message); return; } user->lastping = 0; - user->nextping = ServerInstance->Time() + user->GetClass()->pingtime; + user->nextping = Time::In(user->GetClass()->pingtime); // If the user has an I/O handler that can handle pinging use that // instead. Otherwise, send a ping using an IRC message. -- cgit v1.3.1-10-gc9f91