From 32a127d2e0c0a624d12cf9570905fec264554550 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 1 Mar 2025 16:06:32 +0000 Subject: Avoid the use of ConvToStr in string concatenation. This function calls INSP_FORMAT in most cases nowadays so we may as well just call that manually. --- src/modules/m_spanningtree/treesocket2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/m_spanningtree/treesocket2.cpp') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index eae8cbe21..3d454eef9 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -161,11 +161,11 @@ void TreeSocket::ProcessLine(std::string& line) if (!params.empty()) { time_t them = ServerCommand::ExtractTS(params[0]); - time_t delta = them - ServerInstance->Time(); - if ((delta < -15) || (delta > 15)) + time_t delta = std::abs(them - ServerInstance->Time()); + if (delta > 15) { - ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", labs((long)delta)); - SendError("Your clocks are out by "+ConvToStr(labs((long)delta))+" seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!"); + ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", delta); + SendError(INSP_FORMAT("Your clocks are out by {} seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", delta)); return; } else if ((delta < -5) || (delta > 5)) -- cgit v1.3.1-10-gc9f91