winpr: add high-precision GetTickCountPrecise for Windows.

This commit is contained in:
Vic Lee 2015-06-11 15:11:19 +08:00
parent 07407927c2
commit ad4cdf8810
2 changed files with 17 additions and 0 deletions

View File

@ -295,6 +295,8 @@ WINPR_API ULONGLONG GetTickCount64(void);
#endif
WINPR_API DWORD GetTickCountPrecise(void);
WINPR_API BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature);
/* extended flags */

View File

@ -678,6 +678,21 @@ BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature)
#endif //_WIN32
DWORD GetTickCountPrecise(void)
{
#ifdef _WIN32
LARGE_INTEGER freq;
LARGE_INTEGER current;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&current);
return (DWORD) (current.QuadPart * 1000LL / freq.QuadPart);
#else
return GetTickCount();
#endif
}
BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
{
BOOL ret = FALSE;