Windows 是否为应用程序提供单调递增的时钟 [英] Does Windows provide a monotonically increasing clock to applications

查看:29
本文介绍了Windows 是否为应用程序提供单调递增的时钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题的灵感来自 Linux 是否提供了单调递增的时钟应用程序.

This question is inspired by Does Linux provide a monotonically increasing clock to applications.

也许我应该更精确:我正在寻找一个严格增加的时钟函数,因此永远不会返回相同的值,独立于两个呼叫相互跟随的速度.

Maybe I should be more precise: I'm looking for a clock function which is strictly increasing, thus never returning the same value, independant how quick two calls follow each other.

推荐答案

是的,GetTickCount() 就是这样做的.如果您想要更高保真度的计数器,QueryPerformanceCounter 也可用.这些计数器都不依赖于一天中的时间.

Yes, GetTickCount() does this. If you want a higher fidelity counter, QueryPerformanceCounter is also available. Neither of these counters depend on the time of day.

这篇关于Windows 是否为应用程序提供单调递增的时钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆