gpt4 book ai didi

c - GetTickCount 函数

转载 作者:太空狗 更新时间:2023-10-29 17:04:45 25 4
gpt4 key购买 nike

我有一个关于 GetTickCount 函数的问题,我在我的代码中有两次调用这个函数,它们之间有几个命令,并且两个调用中的函数返回相同的计数。即

var1 = GetTickCount();
code
:
:
var2 = GetTickCount();

var1 和 var2 有相同的值。

有人可以帮忙吗?

最佳答案

假设这是 Windows GetTickCount调用,这是完全合理的:

The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds.

请注意,开始时它只测量毫秒 - 现在您可以在一毫秒内做很多事情。

文档继续说:

If you need a higher resolution timer, use a multimedia timer or a high-resolution timer.

也许 QueryPerformanceCounter会更合适吗?

关于c - GetTickCount 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3453000/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com