本文主要是介绍windows api 和 boost计时 微秒级,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
windows api
boost计时代码,微秒级#include <boost/date_time/posix_time/posix_time.hpp>LARGE_INTEGER freq, start, end;QueryPerformanceFrequency(&freq);QueryPerformanceCounter(&start);::Sleep(1000);QueryPerformanceCounter(&end);double tm = (end.QuadPart - start.QuadPart)*1.0 / freq.QuadPart;std::cout << tm << std::endl;boost::posix_time::ptime ptStart = boost::posix_time::microsec_clock::local_time();::Sleep(1000);boost::posix_time::ptime ptEnd = boost::posix_time::microsec_clock::local_time();std::string strTime = boost::posix_time::to_iso_string(ptEnd-ptStart);std::cout << strTime << std::endl;
这篇关于windows api 和 boost计时 微秒级的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!