getUTCtime() increases irregularly
Jarrett Billingsley
kb3ctd2 at yahoo.com
Thu Apr 5 07:07:06 PDT 2007
"Manfred Nowak" <svv1999 at hotmail.com> wrote in message
news:ev2nlr$cfa$1 at digitalmars.com...
> Sean Kelly wrote
>
>> I believe there are ways to obtain higher-resolution timing
>> information
>
> What about this:
>
> import std.stdio;
> import internal.trace: QueryPerformanceCounter;
>
> int main(char[][] args)
> {
> long t;
> for (int i=0;i<500;i++){
> QueryPerformanceCounter( &t);
> writefln(t);
> }
> return 0;
> }
>
>
> -manfred
std.perf.HighPerformanceCounter uses the same Windows API but will convert
to seconds, milliseconds, and microseconds for you. It's cross-platform,
too, using gettimeofday on *nix platforms.
Unfortunately if David is looking to use this as a timestamp, i.e. in files,
the value you get from QPC doesn't represent any useful amount of time IIRC.
It's just a counter incremented by the processor from the time the computer
starts.
More information about the Digitalmars-d-learn
mailing list