diff options
| author | 2019-12-08 20:39:46 +0000 | |
|---|---|---|
| committer | 2019-12-08 20:39:46 +0000 | |
| commit | 399abe05ea337848da5d6b731217f7bb33a764f6 (patch) | |
| tree | 3ec9d1ef502937e57a4cce6ec0f39276cac53745 /src/inspircd.cpp | |
| parent | Extract root dropping code to a function. (diff) | |
| download | inspircd++-399abe05ea337848da5d6b731217f7bb33a764f6.tar.gz inspircd++-399abe05ea337848da5d6b731217f7bb33a764f6.tar.bz2 inspircd++-399abe05ea337848da5d6b731217f7bb33a764f6.zip | |
Make the UpdateTime function easier to read.
Diffstat (limited to 'src/inspircd.cpp')
| -rw-r--r-- | src/inspircd.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
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 } |
