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