Is there something (planned) in the D L开发者_Python百科ibrary 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 ?
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.
精彩评论