草庐IT

statisticsInterval

全部标签

c++ - 较长的 sleep (在 C++ 中)不如短的 sleep 精确

我有一个任务要每“轮”分钟(在xx:xx:00)做一些事情我使用类似的东西constintstatisticsInterval=60;time_tt=0;while(1){if(abs(t-time(NULL)==0))//toavoidmultiplecallsinthesamesecondthatisthemultipleof60boost::this_thread::sleep(boost::posix_time::seconds(2));//2,not1tomakesurethat1secondpassest=time(NULL);boost::this_thread::sle

c++ - 较长的 sleep (在 C++ 中)不如短的 sleep 精确

我有一个任务要每“轮”分钟(在xx:xx:00)做一些事情我使用类似的东西constintstatisticsInterval=60;time_tt=0;while(1){if(abs(t-time(NULL)==0))//toavoidmultiplecallsinthesamesecondthatisthemultipleof60boost::this_thread::sleep(boost::posix_time::seconds(2));//2,not1tomakesurethat1secondpassest=time(NULL);boost::this_thread::sle