Improved Windows ClockGetMicroseconds precision
Former-commit-id: 601157e2116bc4f3ecd22ec89a285f62e4b36c11
This commit is contained in:
parent
28f46a5c90
commit
ad2c66bbb3
|
|
@ -21,13 +21,13 @@ bool NzClockImplInitializeHighPrecision()
|
||||||
nzUInt64 NzClockImplGetMicroseconds()
|
nzUInt64 NzClockImplGetMicroseconds()
|
||||||
{
|
{
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx
|
||||||
HANDLE thread = GetCurrentThread();
|
//HANDLE thread = GetCurrentThread();
|
||||||
DWORD oldMask = SetThreadAffinityMask(thread, 1);
|
//DWORD oldMask = SetThreadAffinityMask(thread, 1);
|
||||||
|
|
||||||
LARGE_INTEGER time;
|
LARGE_INTEGER time;
|
||||||
QueryPerformanceCounter(&time);
|
QueryPerformanceCounter(&time);
|
||||||
|
|
||||||
SetThreadAffinityMask(thread, oldMask);
|
//SetThreadAffinityMask(thread, oldMask);
|
||||||
|
|
||||||
return time.QuadPart*1000000ULL / frequency.QuadPart;
|
return time.QuadPart*1000000ULL / frequency.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue