summaryrefslogtreecommitdiff
path: root/src/tool_util.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2014-12-14 18:32:41 +0100
committerMarc Hoersken <info@marc-hoersken.de>2014-12-14 18:35:17 +0100
commit7fc1cbb640885cca6c3737cfd451440225ac9ca7 (patch)
treeba348b1f6e037a0ea18ead49433d26516b95cef2 /src/tool_util.c
parentb9950e3b33a82ee26db0c67ab9f54ad5fe1e964f (diff)
downloadcurl-7fc1cbb640885cca6c3737cfd451440225ac9ca7.tar.gz
tool_util.c: Use GetTickCount64 if it is available
Diffstat (limited to 'src/tool_util.c')
-rw-r--r--src/tool_util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tool_util.c b/src/tool_util.c
index 00d205ebc..890122916 100644
--- a/src/tool_util.c
+++ b/src/tool_util.c
@@ -33,10 +33,19 @@ struct timeval tool_tvnow(void)
** GetTickCount() is available on _all_ Windows versions from W95 up
** to nowadays. Returns milliseconds elapsed since last system boot,
** increases monotonically and wraps once 49.7 days have elapsed.
+ **
+ ** GetTickCount64() is available on Windows version from Windows Vista
+ ** and Windows Server 2008 up to nowadays. The resolution of the
+ ** function is limited to the resolution of the system timer, which
+ ** is typically in the range of 10 milliseconds to 16 milliseconds.
*/
struct timeval now;
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
+ ULONGLONG milliseconds = GetTickCount64();
+#else
DWORD milliseconds = GetTickCount();
- now.tv_sec = milliseconds / 1000;
+#endif
+ now.tv_sec = (long)(milliseconds / 1000);
now.tv_usec = (milliseconds % 1000) * 1000;
return now;
}