Permalink
Browse files

timeval: Disable MSVC Analyzer GetTickCount warning

Compiling with msvc /analyze and a recent Windows SDK warns against
using GetTickCount (Suggests to use GetTickCount64 instead.)

Since GetTickCount is only being used when GetTickCount64 isn't
available, I am disabling that warning.

Fixes #3437
Closes #3440
  • Loading branch information...
Michael Kujawa authored and jay committed Jan 5, 2019
1 parent 179311e commit b0a43aade1c786f5c15d6a9fc478c7ae305d8db6
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/timeval.c
@@ -47,7 +47,16 @@ struct curltime Curl_now(void)
(int)((count.QuadPart % freq.QuadPart) * 1000000 / freq.QuadPart);
}
else {
/* Disable /analyze warning that GetTickCount64 is preferred */
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:28159)
#endif
DWORD milliseconds = GetTickCount();
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

now.tv_sec = milliseconds / 1000;
now.tv_usec = (milliseconds % 1000) * 1000;
}

0 comments on commit b0a43aa

Please sign in to comment.