Reputation: 1325
Is there something (planned) in the D Library to support high precision timers like QueryPerformanceCounter in c++ ? How can I have a portable High precision timer in D ?
Or if it is not available, what would be the highest percision timer in D ?
Upvotes: 12
Views: 280
Reputation: 38287
std.datetime has the StopWatch struct for handling precision timing - and it uses QueryPerformanceCounter
internally on Windows. On other OSes, it uses whatever the appropriate, high precision monotonic clock is for them.
If what you need is ticks of the system clock rather than a timer specifically, you can call Clock.currSystemTick for the current tick of the system clock (or Clock.currAppTick for the number of system clock ticks since the application started). But StopWatch
is what you want if you want a timer.
Upvotes: 14