mirror of
https://github.com/znc/znc.git
synced 2026-07-03 00:11:59 +02:00
Centralize logic to get current server time
A few different implementations of computing the current time were spread out through the code base, most of them using gettimeofday(). This centralizes the logic in CUtil::GetTime() for easier maintenance, and also allows all call sites to get the benefit of the clock_gettime() code path on systems that support it.
This commit is contained in:
committed by
Tor Arne Vestbø
parent
852c9832a0
commit
02bfb9eaf5
+1
-6
@@ -37,12 +37,7 @@ CBufLine::CBufLine(const CString& sFormat, const CString& sText,
|
||||
CBufLine::~CBufLine() {}
|
||||
|
||||
void CBufLine::UpdateTime() {
|
||||
timeval tv;
|
||||
if (0 != gettimeofday(&tv, nullptr)) {
|
||||
tv.tv_sec = time(nullptr);
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
m_Message.SetTime(tv);
|
||||
m_Message.SetTime(CUtils::GetTime());
|
||||
}
|
||||
|
||||
CMessage CBufLine::ToMessage(const CClient& Client,
|
||||
|
||||
Reference in New Issue
Block a user