C++ boost timer的用法
#include "boost/timer.hpp"
#include "boost/thread.hpp"
using namespace boost;
#include <iostream>
using namespace std;
int main(int argc, const char **argv){
boost::timer t;
boost::this_thread::sleep(boost::posix_time::seconds(2)); //这里sleep了2秒
cout << t.elapsed() <<endl; //为什么在这里打印出来的时间是0.000102
return 0;
}
timer的时间为什么不准确呢? 还是sleep没用对?