常见延时函数精度对比: timeGetTime、QueryPerformanceCounter 与 GetTickCount
基于事件信号的 CreateWaitableTimer 延时方法相较于传统方式更加节省 CPU 资源,但代码实现相对复杂。以下使用 API 函数进行延时精度测试,结果表明 QueryPerformanceCounter 精度最高:
| 延时函数 | 测量值 | 误差 (毫秒) |
|---------------------|------------|-------------|
| QueryPerformanceCounter | 1000.0006 | 0.00 |
| timeGetTime | 999.3995 | 0.60 |
| GetTickCount (优化) | 999.3569 | 0.64 |
| GetTickCount | 989.1456 | 10.85 |
延时精度测试.zip
预估大小:9个文件
VbsToolTest.vbp
644B
0317延时精度测试-1000毫秒.jpg
31KB
15毫秒精度有的相差9毫秒.jpg
36KB
Form1.frx
5KB
说明.txt
443B
Module1.bas
3KB
Form1.frm
2KB
VbsToolTest.exe
32KB
VbsToolTest.vbw
84B
57.67KB
文件大小:
评论区