Original Post
Ok, I am trying to use timeBeginPeriod with timeGetTime but it's not working. Here's the code:
As you can see I am trying to set precision to 5 ms but timeGetTime keeps on returning with precision of 1 ms. So, what am I doing wrong?
#include <windows.h>
#include <iostream>
using namespace std;
#pragma comment(lib, "Winmm.lib")
int main() {
DWORD time;
if (timeBeginPeriod(5) == TIMERR_NOCANDO) {
cout << "Not can't do...\r\n";
cin.get();
return 0;
}
for (int i = 0; i < 1000; i++) {
time = timeGetTime();
cout << time << "\r\n";
}
timeEndPeriod(5);
cin.get();
return 0;
}
As you can see I am trying to set precision to 5 ms but timeGetTime keeps on returning with precision of 1 ms. So, what am I doing wrong?