c++11 this_thread::sleep_for至少十几毫秒的解决办法
使用 timeBeginPeriod(1);提升定时器精度,经测试,依然无法确保1ms,实际在1~2ms之间。使用之后记得 timeEndPeriod(1); 关闭定时器精度的提升。上面的函数需要 加入头文件 #include <timeapi.h> #include <mmsystem.h>还需要加入库 #pragma comment( lib, "winmm")VS20
·
使用 timeBeginPeriod(1);提升定时器精度,经测试,依然无法确保1ms,实际在1~2ms之间。
使用之后记得 timeEndPeriod(1); 关闭定时器精度的提升。
上面的函数需要 加入头文件 #include <timeapi.h> #include <mmsystem.h>
还需要加入库 #pragma comment( lib, "winmm")
VS2019 vc++平台正常运行
更多推荐
所有评论(0)