aboutsummaryrefslogtreecommitdiff
path: root/src/xz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-05 21:33:35 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-09-22 20:00:38 +0300
commitc660b8d78b7bda43b12b285550d8c70e8ccec698 (patch)
treebc3380c69a5fc04b53eb686a6db2824cc0da60dc /src/xz
parentMSVC: xz: Use _stricmp() instead of strcasecmp() in suffix.c. (diff)
downloadxz-c660b8d78b7bda43b12b285550d8c70e8ccec698.tar.xz
MSVC: xz: Use GetTickCount64() to implement mytime_now().
It's available since Windows Vista.
Diffstat (limited to '')
-rw-r--r--src/xz/mytime.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/xz/mytime.c b/src/xz/mytime.c
index 9eff566f..4c13d377 100644
--- a/src/xz/mytime.c
+++ b/src/xz/mytime.c
@@ -12,7 +12,9 @@
#include "private.h"
-#ifdef HAVE_CLOCK_GETTIME
+#if defined(_MSC_VER)
+ // Nothing
+#elif defined(HAVE_CLOCK_GETTIME)
# include <time.h>
#else
# include <sys/time.h>
@@ -45,7 +47,11 @@ static uint64_t next_flush;
static uint64_t
mytime_now(void)
{
-#ifdef HAVE_CLOCK_GETTIME
+#if defined(_MSC_VER)
+ // NOTE: This requires Windows Vista or later.
+ return GetTickCount64();
+
+#elif defined(HAVE_CLOCK_GETTIME)
struct timespec tv;
# ifdef HAVE_CLOCK_MONOTONIC
@@ -60,6 +66,7 @@ mytime_now(void)
# endif
return (uint64_t)tv.tv_sec * 1000 + (uint64_t)(tv.tv_nsec / 1000000);
+
#else
struct timeval tv;
gettimeofday(&tv, NULL);