1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 09:08:49 -05:00

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 https://github.com/curl/curl/issues/3437
Closes https://github.com/curl/curl/pull/3440
This commit is contained in:
Michael Kujawa 2019-01-04 20:18:25 -05:00 committed by Jay Satiro
parent 179311ec37
commit b0a43aade1

View File

@ -47,7 +47,16 @@ struct curltime Curl_now(void)
(int)((count.QuadPart % freq.QuadPart) * 1000000 / freq.QuadPart); (int)((count.QuadPart % freq.QuadPart) * 1000000 / freq.QuadPart);
} }
else { else {
/* Disable /analyze warning that GetTickCount64 is preferred */
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:28159)
#endif
DWORD milliseconds = GetTickCount(); DWORD milliseconds = GetTickCount();
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
now.tv_sec = milliseconds / 1000; now.tv_sec = milliseconds / 1000;
now.tv_usec = (milliseconds % 1000) * 1000; now.tv_usec = (milliseconds % 1000) * 1000;
} }