草庐IT

NtDelayExecution

全部标签

c++ - Windows 8(.1) 比需要多睡 1 毫秒

Windows8.1x64上的休眠总是比需要多持续1毫秒。例如Sleep(1)持续大约2毫秒,Sleep(2)-3等。timeBeginPeriod设置为1。在Windows7按预期工作正常(没有多余的毫秒数)。这种行为是否正常/是否可以修复?#include#include#pragmacomment(lib,"winmm.lib")LARGE_INTEGERFrequency;longlongintGetCurrent(){LARGE_INTEGERcounter;QueryPerformanceCounter(&counter);return(1000000*counter.Qu