aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-09-20 17:40:04 +0100
committerGuy Harris <gharris@sonic.net>2021-09-21 05:56:34 +0000
commit3164d4a646f0226306b397f6721e58a5f66c7bff (patch)
tree3fa41eaf88f570582dde9516d53d71fc13fdc04e /ui/qt
parent2f7e3f1d82d7892bb5b742bbee725bae74e290ca (diff)
MinGW-w64: Use clock_gettime()
Mingw-w64 has this function. We may have to define some extra symbols for API visibility but on my system the config check is working out of the box. POSIX systems come in many flavours, remove the "save time" if() condition in this case. Fix code to check if we have clock_gettime() on Windows as well.
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/import_text_dialog.cpp10
1 files changed, 5 insertions, 5 deletions
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;