Re: Regarding time resolution in microsecond



"Rajat" <Rajat@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D46DF74C-CF0D-41D5-A4F1-759F25AAD682@xxxxxxxxxxxxxxxx
> Hi All,
>
> Could any body point out, how to get time in microsecond precision. As if
we
> use, timeBeginPeriod(1) also it will provide a resolution of 1
milisecond(or
> 1000 microsecond). Is there any way to get this resolution of 1
microsecond,
> or atleast
> 20 microsecond.
>
> Any pointer will be help full.
>
> Thanks in advance.

QueryPerformanceCounter often gives sub-microsecond accuracies. You need to
call QueryPerformanceFrequency to get the exact value of the timing
interval. Start at
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancecounter.asp

If your interest is in timing of code, then look at "How To Use
QueryPerformanceCounter to Time Code" at
http://support.microsoft.com/kb/q172338/

or "How To: Time Managed Code Using QueryPerformanceCounter and
QueryPerformanceFrequency" at
http://msdn.microsoft.com/library/en-us/dnpag/html/ScaleNetHowTo09.asp

Mike


.