Created
February 24, 2015 16:35
-
-
Save divinity76/e7be8aafe32d66e465f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned __int64 freq; | |
QueryPerformanceFrequency((LARGE_INTEGER*)&freq); | |
double timerFrequency = (1.0 / freq); | |
unsigned __int64 startTime; | |
QueryPerformanceCounter((LARGE_INTEGER *)&startTime); | |
int_fast32_t i = 0; | |
for (i = 0; i < 1000; ++i){ | |
Sleep(1); | |
} | |
unsigned __int64 endTime; | |
QueryPerformanceCounter((LARGE_INTEGER *)&endTime); | |
double timeDifferenceInMilliseconds = ((endTime - startTime) * timerFrequency); | |
std::cout << "used " << timeDifferenceInMilliseconds << " seconds to Winapi Sleep 1 ms, 1000 times" << std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment