Re: GetLocalTime Accuracy
"Jonathan" <Jonathan@discussions.microsoft.com> wrote in message
news:3D7DA356-25B7-4534-BD8F-2EFB89051D64@microsoft.com...
I am using the function GetLocalTime in VC++ 6 and I would like to know
how
accurate the milliseconds portion of the returned time is?
No version of Windows (except perhaps Windows CE) is a realtime operating
system with hard guarantees as to timing. Even if the time returned was
accurate to the micro-second, it is possible that immediately after
returning it, WIndows will cede the processor to some other thread and the
caller may not run for a very long time making rendering the data "stale"
when you try to access it.
That said, if you want to improve your odds of getting good timing
information, add a
timeBeginPeriod(1);
call at the point just before you'd like accurate time measurements and add
a
timeEndPeriod(1)
when your timings are done. On a busy system, you'll likely want to elevate
the calling thread's priority as well.
You'd still have no guarantees, but you should get better results.
Regards,
Will