windows api 和 boost计时 微秒级

来源:互联网 发布:究极风暴4优化补丁1.3a 编辑:程序博客网 时间:2024/05/22 07:53
windows apiboost计时代码,微秒级    #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;

原创粉丝点击