diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 58f3e5f6dd..1b8d28a695 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -80,19 +80,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.] check_function_exists("getexecname" HAVE_GETEXECNAME) endif() -# -# Check whether we have clock_gettime(). -# It's not on Windows, so don't waste time checking for it. -# It's in newer POSIX, so some, but not all, UN*Xes have it. -# -if (NOT WIN32) - # - # POSIX - don't bother checking on Windows, as checks - # take time. - # - check_function_exists("clock_gettime" HAVE_CLOCK_GETTIME) -endif (NOT WIN32) - +check_function_exists("clock_gettime" HAVE_CLOCK_GETTIME) check_function_exists("getifaddrs" HAVE_GETIFADDRS) check_function_exists("issetugid" HAVE_ISSETUGID) check_function_exists("setresgid" HAVE_SETRESGID) diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp index e5b821a9cf..2e4b914e9c 100644 --- a/ui/qt/import_text_dialog.cpp +++ b/ui/qt/import_text_dialog.cpp @@ -618,15 +618,15 @@ void ImportTextDialog::on_timestampFormatLineEdit_textChanged(const QString &tim char time_str[100]; QString timefmt = QString(time_format); -#if defined(_WIN32) +#if defined(HAVE_CLOCK_GETTIME) + // Newer POSIX API. Some UN*Xes whose C libraries lack + // timespec_get() (C11) have this. + clock_gettime(CLOCK_REALTIME, &timenow); +#elif defined(_WIN32) // At least some Windows C libraries have this. // Some UN*X C libraries do, as well, but they might not // show it unless you're requesting C11 - or C++17. timespec_get(&timenow, TIME_UTC); -#elif defined(HAVE_CLOCK_GETTIME) - // Newer POSIX API. Some UN*Xes whose C libraries lack - // timespec_get() (C11) have this. - clock_gettime(CLOCK_REALTIME, &timenow); #else // Fall back on gettimeofday(). struct timeval usectimenow;