常见延时函数精度对比: 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
延时精度测试.zip 预估大小:9个文件
file
VbsToolTest.vbp 644B
file
0317延时精度测试-1000毫秒.jpg 31KB
file
15毫秒精度有的相差9毫秒.jpg 36KB
file
Form1.frx 5KB
file
说明.txt 443B
file
Module1.bas 3KB
file
Form1.frm 2KB
file
VbsToolTest.exe 32KB
file
VbsToolTest.vbw 84B
zip 文件大小:57.67KB