summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-08-23 09:58:15 -0400
committerGitHub <noreply@github.com>2019-08-23 09:58:15 -0400
commit60319788928def21d2164e472a0347bcd8cdab70 (patch)
treea6ee64a49d2da8995b3f206edff01e63171a6dcc
parentfeac594588752615094b18360ab0642b086a3d4b (diff)
parent071750a386c28d195f2c726c456a0f3d1831b416 (diff)
downloadlibgit2-60319788928def21d2164e472a0347bcd8cdab70.tar.gz
Merge pull request #5054 from tniessen/util-use-64-bit-timer
util: use 64 bit timer on Windows
-rw-r--r--CMakeLists.txt5
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/util.h17
3 files changed, 7 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e6443a0c..8e8ee3b6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -263,6 +263,11 @@ ELSE ()
ENDIF ()
ENDIF()
+# Ensure that MinGW provides the correct header files.
+IF (WIN32 AND NOT CYGWIN)
+ ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0600)
+ENDIF()
+
IF( NOT CMAKE_CONFIGURATION_TYPES )
# Build Debug by default
IF (NOT CMAKE_BUILD_TYPE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 750085b5e..de7e408ae 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -299,8 +299,6 @@ FILE(GLOB SRC_H
# On Windows use specific platform sources
IF (WIN32 AND NOT CYGWIN)
- ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0600)
-
IF(MSVC)
SET(WIN_RC "win32/git2.rc")
ENDIF()
diff --git a/src/util.h b/src/util.h
index 792eba003..b49850d23 100644
--- a/src/util.h
+++ b/src/util.h
@@ -357,22 +357,9 @@ GIT_INLINE(void) git__memzero(void *data, size_t size)
GIT_INLINE(double) git__timer(void)
{
- /* We need the initial tick count to detect if the tick
- * count has rolled over. */
- static DWORD initial_tick_count = 0;
-
- /* GetTickCount returns the number of milliseconds that have
+ /* GetTickCount64 returns the number of milliseconds that have
* elapsed since the system was started. */
- DWORD count = GetTickCount();
-
- if(initial_tick_count == 0) {
- initial_tick_count = count;
- } else if (count < initial_tick_count) {
- /* The tick count has rolled over - adjust for it. */
- count = (0xFFFFFFFF - initial_tick_count) + count;
- }
-
- return (double) count / (double) 1000;
+ return (double) GetTickCount64() / (double) 1000;
}
#elif __APPLE__