HighPerformanceCounter rounding
Lutger
lutger.blijdestijn at gmail.com
Wed Oct 25 06:42:07 PDT 2006
nobody_ wrote:
> foo being some random function
>
> foo took: 14896947 microseconds
> foo took: 14896 milliseconds
> foo took: 14 seconds
>
> Simple rounding :)
>
> How accurate are these readings on a windows XP machine?
> They seem pretty accurate (except for the simple rounding).
>
> I tested the following
>
> c.start();
> std.c.time.usleep(1000001);
> c.stop();
>
> usleep took: 999789
> usleep took: 999
> usleep took: 0
>
> It isn't a big difference, but still... :)
>
>
It's probably because of the sleep function, this can be off by about 10
to 16 ms usually on windows, iirc.
Beware that sometimes QueryPerformanceCounter, which
HighPerformanceCounter uses, can behave erratically on dualcore systems
and systems with variabele clock speeds (Intel's Speed Step, AMD's cool
'n quiet).
More information about the Digitalmars-d-learn
mailing list