阅读:3133回复:35
windows下,有没有方法可以实现1ms或更小的精确定时
霍霍
|
|
最新喜欢:![]()
|
沙发#
发布于:2002-10-14 10:02
没深入研究过,传说Windows提供的多媒体API可以比较精确定时。
|
|
|
板凳#
发布于:2002-10-14 10:11
偶也听说了,那个能精确到多少 :D
|
|
|
地板#
发布于:2002-10-14 10:13
偶也听说了,那个能精确到多少 :D 估计至少1ms |
|
|
地下室#
发布于:2002-10-14 10:18
有没有具体的用法,给个函数名也行呀,我好查一下。
花猫,多谢,等等别的回答再放分给你 :D |
|
|
5楼#
发布于:2002-10-14 10:22
有没有具体的用法,给个函数名也行呀,我好查一下。 你以为我在骗分啊??? :mad: :mad: :mad: :mad: :mad: 刚找到的,你仔细看看吧,可能有用,我没仔细看 timeBeginPeriod timeEndPeriod timeGetDevCaps timeGetSystemTime timeGetTime timeKillEvent TimeProc timeSetEvent |
|
|
6楼#
发布于:2002-10-14 10:25
应该够用
About Multimedia Timers Multimedia timer services allow applications to schedule timer events with the greatest resolution (or accuracy) possible for the hardware platform. These multimedia timer services allow you to schedule timer events at a higher resolution than other timer services. These timer services are useful for applications that demand high-resolution timing. For example, a MIDI sequencer requires a high-resolution timer because it must maintain the pace of MIDI events within a resolution of 1 millisecond. Applications that do not use high-resolution timing should use the SetTimer function instead of multimedia timer services. The timer services provided by SetTimer post WM_TIMER messages to a message queue, while the multimedia timer services call a callback function. Applications that want a waitable timer should use the CreateWaitableTimer function |
|
|
7楼#
发布于:2002-10-14 10:33
花猫息怒,霍霍 :D
多谢多谢,我去试试 :D |
|
|
8楼#
发布于:2002-10-14 12:14
用多媒体定时器肯定不行。
|
|
|
9楼#
发布于:2002-10-14 12:29
用多媒体定时器肯定不行。 为什么这么说 大狗有什么更好的方法 |
|
|
10楼#
发布于:2002-10-14 12:39
[quote]用多媒体定时器肯定不行。 为什么这么说 大狗有什么更好的方法 [/quote] 我用过。定时间隔会受其它任务的影响。(比较严重) 我觉的得做个驱动,并修改计算机的硬件中断。(没做过) |
|
|
11楼#
发布于:2002-10-14 12:41
我用过。定时间隔会受其它任务的影响。(比较严重) 那岂不是和SetTimer一样?我觉得多媒体定时精度应该还是比较高的,不然多媒体真的有问题了。 你改硬件中断,估计系统会不正常。 |
|
|
12楼#
发布于:2002-10-14 12:53
我回去看看书再告诉你。 :D
|
|
13楼#
发布于:2002-10-14 12:56
SetTimer 的精度更差,不可能小于 windows 的时间片的大小。
(9x:55ms,NT/2K 20ms),且受影响更严重。 我测过的,用 delphi,仅把窗口最大化,最小化,就会影响多媒体定时器。 把硬件中断提高 N 倍,每中断 N 次后再去调原来的中断程序。 |
|
|
14楼#
发布于:2002-10-14 12:58
SetTimer 的精度更差,不可能小于 windows 的时间片的大小。 我相信Windows里的时钟中断不可能是18.2,估计是1000后者再大些(谁知道确切的?),你还怎么提高?再提高的话,可能你处理中断的时间已经超过了时钟中断时间,那后果就是………………………… 系统严重不稳定 |
|
|
15楼#
发布于:2002-10-14 13:05
再提高的话,可能你处理中断的时间已经超过了时钟中断时间,那后果就是………………………… 如果 1ms 的中断程序执行时间超过 1ms ,那怎么做也是没用。 |
|
|
16楼#
发布于:2002-10-14 13:12
[quote]再提高的话,可能你处理中断的时间已经超过了时钟中断时间,那后果就是………………………… 如果 1ms 的中断程序执行时间超过 1ms ,那怎么做也是没用。 [/quote] 不是1ms,Windows本来的不会超过这个的,但你在小,比如0.1毫秒,那可能就有问题了 |
|
|
17楼#
发布于:2002-10-14 13:15
他要 1ms 的,我干吗要做 0.1ms 的?
|
|
|
18楼#
发布于:2002-10-14 13:16
好呀好呀
继续, 我喜欢 :D |
|
|
19楼#
发布于:2002-10-14 13:16
他要 1ms 的,我干吗要做 0.1ms 的? 那多媒体还不够??? 够了 |
|
|
上一页
下一页