How to Programm Timer with high resolution (not system timer)
less 5 ms.
Printable View
How to Programm Timer with high resolution (not system timer)
less 5 ms.
Read the system time, store that, then keep on reading it comparing with the original until the elapsed time required has happened?
Outrageously crude and inefficient but best I can offer with so little to go on.
Get a copy of the DDK and do it through interupts.
Slightly less crude but still inefficant.
[edit]
oh and I forgot to mention difficult and not worth the effort
[/edit]
High performance timer you say? Try these, QueryPerformanceCounter and you will need QueryPerformanceFrequency to see if it's supported and if so what the frequency is. Look it up on MSDN, I think this is what you were looking for.
Perhaps you can use SetTimer to create a timer. The time-out value is in milliseconds.
Code:UINT SetTimer
(
HWND hWnd, // handle of window for timer messages
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
);
It depends how accurate you want it....if you want it to be roughly x milliseconds then SetTimer and the like will be ok......but if you want more accuracy it can be much harder (depending on the accuracy you want)
And lying roughly in the middle in the 'accuracy stakes is the multimedia timer which you can get a 'time' with the timeGetTime fn. #include <mmsystem.h> and link with winmm.lib (msvc, borland, lcc-win32) or libwinmm.a (MinGW; can also use '-lwinmm').
He said he didn't want to use a system timer.
If you dont want a system timer then dont post on the Windows board since this is for "Windows System Proramming!"
>>He said he didn't want to use a system timer.<<
Major ooops! experience. One day i'll get this skim-reading right. ;)
Sorry for any confusion I may have caused. :)