diff --git a/src/xz/mytime.c b/src/xz/mytime.c index ddfd5deb..4d8da513 100644 --- a/src/xz/mytime.c +++ b/src/xz/mytime.c @@ -14,7 +14,7 @@ #if defined(MYTHREAD_VISTA) || defined(_MSC_VER) // Nothing -#elif defined(HAVE_CLOCK_GETTIME) +#elif defined(HAVE_CLOCK_GETTIME) && !defined(__MINGW32__) # include #else # include @@ -59,7 +59,12 @@ mytime_now(void) // there's no reason to avoid a WinVista API here either. return GetTickCount64(); -#elif defined(HAVE_CLOCK_GETTIME) +#elif defined(HAVE_CLOCK_GETTIME) && !defined(__MINGW32__) + // MinGW-w64: clock_gettime() is defined in winpthreads but we need + // nothing else from winpthreads. By avoiding clock_gettime(), we + // avoid the dependency on libwinpthread-1.dll or the need to link + // against the static version. The downside is that the fallback + // method, gettimeofday(), doesn't provide monotonic time. struct timespec tv; # ifdef HAVE_CLOCK_MONOTONIC