GetTickCount() 是否包括暂停或休眠的时间? [英] Does GetTickCount() include time spent suspended or hibernated?

查看:39
本文介绍了GetTickCount() 是否包括暂停或休眠的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

澄清一下,我指的是系统挂起/休眠所花费的时间,而不是调用线程(GetTickCount() 返回系统启动后的毫秒数).

To clarify, I mean time spent while the system is suspended/hibernated, not the calling thread (GetTickCount() returns the number of milliseconds since system boot).

推荐答案

据我所知,GetTickCount 与线程无关,计算系统启动后的时间.但最好使用 GetTickCount64 来避免49.7 天轮换.

As far as I know, GetTickCount is unrelated to threads and counts the time since the system has started. But it is better to use GetTickCount64 to avoid the 49.7 day roleover.

顺便说一下,要获得您想要的东西,您需要 GetThreadTimes 函数.它记录创建和退出时间以及线程在用户或内核空间中花费的时间.所以你有一个很好的方法来计算花费的时间.

By the way, to get what you want you need the GetThreadTimes function. It records the creation and exit time and the amount of time the thread has spend in user or kernel space. So you have a nice way to calculate the amount of time spend.

好的,我错过了问题的系统"部分.但这很简单.当处于休眠状态时 GetTickCount 继续计数.因为当计算机大部分时间处于休眠状态时,人们遭受了 49.7 天的错误.请参阅此处的链接文本了解更多信息.

Ok, I missed the "system" part of the question. But that is simple. When in hibernation GetTickCount continues the counting. Because people have suffered from the 49.7 days bug when the computer was in hibernate most of the time. See link text here for more information.

这篇关于GetTickCount() 是否包括暂停或休眠的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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