Re: Accurate time measurement

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Paul MH" <paulmorrishill@xxxxxxxxxxxxxx> wrote in message
news:1177782440.185915.145290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

thanks for replys ive found some information about
different accuricies
http://support.microsoft.com/kb/172338

I've just had a quick look at that Microsoft link and it explains away the
10 millisecond (on their own test machine) resolution of GetTickCount and
timeGetTime by saying, "Multiple statements execute before either
GetTickCount or timeGetTime record a change" and adding, "The actual number
of loops will vary depending on the background tasks the operating system is
executing". I find that statement at best totally misleading and at worst
completely untrue, at least as an explanation as to why it takes 10
milliseconds between "ticks". In actual fact the "reading" of the
appropriate counter by GetTickCount and by timeGetTime is actually very much
faster than the reading of the appropriate counter by
QueryPerformanceCounter. And they make no mention of the fact that you can
increase the resolution of both GetTickCount and timeGetTime using
timeBeginPeriod. Odd that :-)

Mike








.



Relevant Pages

  • Re: Timer accuracy.
    ... >> resolution timer and is more accurate than GetTickCount ... >> Private Declare Function timeGetTime _ ... >You have to be a bit careful about the timeGetTime function Jerry. ...
    (microsoft.public.vb.general.discussion)
  • Re: Timer accuracy.
    ... Private Declare Function timeGetTime Lib "winmm.dll" As Long ... Private Declare Function GetTickCount Lib "kernel32" As Long ... they both have 15ms to 16 ms resolution. ...
    (microsoft.public.vb.general.discussion)
  • Re: Constructing a more precise "Now()" and "DateDiff()"
    ... However, if you actually do want to use a "timestamp" and if the resolution of my own suggested method of using GetLocalTime is not sufficient for you then why not just record the actual time at the start of your program. ... Then every time you want to know the current time you simply use the timeGetTime function and deduct from its returned value the initial value that you got from timeGetTime at the start of your program. ... The resolution of timeGetTime is one millisecond. ... if the one millisecond resolution of timeGetTime is still not sufficient for your purposes you can instead use QueryPerformanceCounter in a similar way. ...
    (microsoft.public.vb.general.discussion)
  • Re: GetTickCount()/timeGetTime across processes
    ... >> timeGetTime() is not a global value. ... Millisecond resolution is good enough for my purpose and it's ... Yes -- that's why I'm using timeGetTimeafter calling timeBeginPeriod() to ... One possible explanation for the discrepancy between the tick count returned ...
    (microsoft.public.win32.programmer.kernel)
  • Re: GetTickCount()/timeGetTime across processes
    ... >> often precedes the time logged by the client process. ... >> timeGetTime() is not a global value. ... Millisecond resolution is good enough for my purpose and it's ... Yes -- that's why I'm using timeGetTimeafter calling timeBeginPeriod() to ...
    (microsoft.public.win32.programmer.kernel)