计时器的滴答时间不少于15毫秒 [英] Timer does not tick less than 15 milliseconds

查看:91
本文介绍了计时器的滴答时间不少于15毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Windows time(VC ++)r以11毫秒的间隔来调用我的函数,但是当我在回调函数中打印时间时,我发现它不是以11 ms的间隔被调用,而是以15-16毫秒.如果我将间隔设置为17,则会在间隔31到32毫秒之间调用它.
我不知道为什么会这样?

然后我在同一台机器上的C#中调用了类似的函数,它也显示了相同的间隔.我正在使用具有2 GB RAM的Intel Core to Duo机器.
当我阅读计时器MSDN时,我发现它可以提供高达10毫秒的精度.
任何人都可以建议我适当解决我的问题,以便它可以达到10毫秒的精度.
预先感谢您的帮助.

I have used windows time(VC++)r to call my function at interval of 11 millisecond but when I print time in my callback function I found out that it is not getting called at interval of 11 ms but it is getting called at 15-16 milliseconds. If I give interval as 17 it is getting called at interval 31 to 32 milliseconds.
I dont know why this is happening??

then I have called similar function in C# on same machine, it also shows same interval. I am using Intel Core to Duo machine with 2 GB RAM.
When I read timer MSDN I found out that it gives acceracy upto 10 milli second.
Can Anybody suggest me proper solution to my problem so that it can get accuracy upto 10 millisecond.
Thank you in advance for your help.

推荐答案

Windows计时器通常在硬件计时器上运行,该计时器的分辨率为10-15ms(取决于硬件,大多数运行间隔为15.6毫秒),因此当您要求较低的间隔时,计时器值的精度为10毫秒,但计时器间隔的分辨率为15毫秒.

这里有一篇文章可能会有所帮助,但是您需要做一些工作! http://msdn.microsoft.com/en-us/magazine/cc163996.aspx [ ^ ]
Windows timers generally run off the hardware timer, which has a resolution of 10 - 15ms (depending on the hardware, most run at 15.6ms intervals) so when you ask for a lower interval, you get an accuracy of 10ms in teh timer value, but a resolution of 15ms in the timer interval.

There is an article here which may help, but you have some work to do! http://msdn.microsoft.com/en-us/magazine/cc163996.aspx[^]


这篇关于计时器的滴答时间不少于15毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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