开发者

QueryPerformanceCounter in D?

开发者 https://www.devze.com 2023-04-08 12:33 出处:网络
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 ?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消