mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +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
+2
-8
@@ -70,14 +70,8 @@ class CUtils {
|
||||
unsigned int uMin = 0, unsigned int uMax = ~0,
|
||||
unsigned int uDefault = ~0);
|
||||
|
||||
static unsigned long long GetMillTime() {
|
||||
struct timeval tv;
|
||||
unsigned long long iTime = 0;
|
||||
gettimeofday(&tv, nullptr);
|
||||
iTime = (unsigned long long)tv.tv_sec * 1000;
|
||||
iTime += ((unsigned long long)tv.tv_usec / 1000);
|
||||
return iTime;
|
||||
}
|
||||
static timeval GetTime();
|
||||
static unsigned long long GetMillTime();
|
||||
#ifdef HAVE_LIBSSL
|
||||
static void GenerateCert(FILE* pOut, const CString& sHost = "");
|
||||
#endif /* HAVE_LIBSSL */
|
||||
|
||||
Reference in New Issue
Block a user