aboutsummaryrefslogtreecommitdiff
path: root/src/xz/mytime.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-24 00:21:22 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-10-22 18:59:45 +0300
commitcdb4d91f2464b50c985ef7b9517314ea237ddda7 (patch)
treebe49c0c0ffdeddedab08466fe2d189857fd8f8a0 /src/xz/mytime.c
parentliblzma: Move is_clmul_supported() back to crc_common.h. (diff)
downloadxz-cdb4d91f2464b50c985ef7b9517314ea237ddda7.tar.xz
xz/Windows: Use GetTickCount64() with MinGW-w64 if using Vista threads.
Diffstat (limited to '')
-rw-r--r--src/xz/mytime.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/xz/mytime.c b/src/xz/mytime.c
index 4c13d377..ddfd5deb 100644
--- a/src/xz/mytime.c
+++ b/src/xz/mytime.c
@@ -12,7 +12,7 @@
#include "private.h"
-#if defined(_MSC_VER)
+#if defined(MYTHREAD_VISTA) || defined(_MSC_VER)
// Nothing
#elif defined(HAVE_CLOCK_GETTIME)
# include <time.h>
@@ -47,8 +47,16 @@ static uint64_t next_flush;
static uint64_t
mytime_now(void)
{
-#if defined(_MSC_VER)
- // NOTE: This requires Windows Vista or later.
+#if defined(MYTHREAD_VISTA) || defined(_MSC_VER)
+ // Since there is no SIGALRM on Windows, this function gets
+ // called frequently when the progress indicator is in use.
+ // Progress indicator doesn't need high-resolution time.
+ // GetTickCount64() has very low overhead but needs at least WinVista.
+ //
+ // MinGW-w64 provides the POSIX functions clock_gettime() and
+ // gettimeofday() in a manner that allow xz to run on older
+ // than WinVista. If the threading method needs WinVista anyway,
+ // there's no reason to avoid a WinVista API here either.
return GetTickCount64();
#elif defined(HAVE_CLOCK_GETTIME)