From 399abe05ea337848da5d6b731217f7bb33a764f6 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 8 Dec 2019 20:39:46 +0000 Subject: Make the UpdateTime function easier to read. --- src/inspircd.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 7dcaeb9b6..45649810b 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -564,21 +564,20 @@ InspIRCd::InspIRCd(int argc, char** argv) void InspIRCd::UpdateTime() { -#ifdef _WIN32 +#if defined HAS_CLOCK_GETTIME + clock_gettime(CLOCK_REALTIME, &TIME); +#elif defined _WIN32 SYSTEMTIME st; GetSystemTime(&st); TIME.tv_sec = time(NULL); TIME.tv_nsec = st.wMilliseconds; #else - #ifdef HAS_CLOCK_GETTIME - clock_gettime(CLOCK_REALTIME, &TIME); - #else - struct timeval tv; - gettimeofday(&tv, NULL); - TIME.tv_sec = tv.tv_sec; - TIME.tv_nsec = tv.tv_usec * 1000; - #endif + struct timeval tv; + gettimeofday(&tv, NULL); + + TIME.tv_sec = tv.tv_sec; + TIME.tv_nsec = tv.tv_usec * 1000; #endif } -- cgit v1.2.3