aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-03-03 14:47:35 +0000
committerGravatar Sadie Powell2025-03-03 14:47:35 +0000
commitabba3ed1e60f6d5d1f0a69460dc864cd7b2c429a (patch)
treec386956c13ea8089964b5eeb0436f81c70bd3d67 /src/modules/m_spanningtree
parentAdd Duration::ToHuman and update messages to use it. (diff)
Use Duration::ToHuman instead of seconds in various messages.
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/pingtimer.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp8
3 files changed, 10 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index c1e74d4c4..cf91fa7ec 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -30,6 +30,7 @@
#include "clientprotocolmsg.h"
#include "iohook.h"
#include "socket.h"
+#include "timeutils.h"
#include "xline.h"
#include "commands.h"
@@ -302,7 +303,8 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
}
else if (curtime > s->age + (time_t)p.second)
{
- ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002 (timeout of {} seconds)", p.first, p.second);
+ ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002 (timeout of {})",
+ p.first, Duration::ToHuman(p.second));
Utils->timeoutlist.erase(me);
s->Close();
}
diff --git a/src/modules/m_spanningtree/pingtimer.cpp b/src/modules/m_spanningtree/pingtimer.cpp
index c9535366c..a6d193bfb 100644
--- a/src/modules/m_spanningtree/pingtimer.cpp
+++ b/src/modules/m_spanningtree/pingtimer.cpp
@@ -19,6 +19,7 @@
#include "inspircd.h"
+#include "timeutils.h"
#include "pingtimer.h"
#include "treeserver.h"
@@ -48,7 +49,8 @@ PingTimer::State PingTimer::TickInternal()
else if (state == PS_WARN)
{
// No pong arrived in PingWarnTime seconds, send a warning to opers
- ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {} seconds, high latency.", server->GetName(), GetInterval());
+ ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {}, high latency.",
+ server->GetName(), Duration::ToHuman(GetInterval()));
return PS_TIMEOUT;
}
else // PS_TIMEOUT
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 563099bae..e8fa38a54 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -164,13 +164,13 @@ void TreeSocket::ProcessLine(std::string& line)
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", delta);
- SendError(INSP_FORMAT("Your clocks are out by {} seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", delta));
+ ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", Duration::ToHuman(delta));
+ SendError(INSP_FORMAT("Your clocks are out by {} (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", Duration::ToHuman(delta)));
return;
}
- else if ((delta < -5) || (delta > 5))
+ else if (delta > 5)
{
- ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {} seconds. Please consider syncing your clocks.", labs((long)delta));
+ ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {}. Please consider syncing your clocks.", Duration::ToHuman(delta));
}
}