From f5c865015c8697ca282b73f6b899eb2ed7347591 Mon Sep 17 00:00:00 2001 From: RealKindOne Date: Thu, 1 Oct 2026 20:00:11 -0400 Subject: [PATCH] listsockets: Add TODO comment and update test. --- modules/listsockets.cpp | 2 ++ test/integration/tests/modules.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/listsockets.cpp b/modules/listsockets.cpp index 9790abc5..917dd235 100644 --- a/modules/listsockets.cpp +++ b/modules/listsockets.cpp @@ -155,6 +155,8 @@ class CListSockets : public CModule { unsigned long long iStartTime = pSocket->GetStartTime(); unsigned long long iNow = CUtils::GetMillTime(); + // TODO This code would look simpler with std::chrono instead. + // Especially if socket API is changed to use that. timeval tv = CUtils::GetTime(); unsigned long long iAgeUs = (iNow - iStartTime) * 1000; diff --git a/test/integration/tests/modules.cpp b/test/integration/tests/modules.cpp index 95041926..fe315901 100644 --- a/test/integration/tests/modules.cpp +++ b/test/integration/tests/modules.cpp @@ -1222,8 +1222,11 @@ TEST_F(ZNCTest, ListSocketsModule) { client.Write("znc loadmod listsockets"); client.ReadUntil("Loaded module"); client.Write("PRIVMSG *listsockets :list"); + int year = QDate::currentDate().year(); ASSERT_THAT(client.ReadRemainder().toStdString(), - Not(HasSubstr("1970-"))); + AnyOf(HasSubstr(std::to_string(year - 1) + "-"), + HasSubstr(std::to_string(year) + "-"), + HasSubstr(std::to_string(year + 1) + "-"))); } } // namespace