我的诺基亚手机没有秒表,总要找同事借,干脆自己写了一个
精度是 microsecond
#include <iostream>
#include "boost/date_time/posix_time/posix_time.hpp"
using namespace std;
using namespace boost::posix_time;
int main(void){
ptime start, suspend;
start = microsec_clock::local_time();
while(getchar()){
suspend = microsec_clock::local_time();
cout<< suspend - start<<endl;
}
return 0;
}
#include "boost/date_time/posix_time/posix_time.hpp"
using namespace std;
using namespace boost::posix_time;
int main(void){
ptime start, suspend;
start = microsec_clock::local_time();
while(getchar()){
suspend = microsec_clock::local_time();
cout<< suspend - start<<endl;
}
return 0;
}
然后
g++ timer.cpp -o timer.exe -Ie:\boost_1_39_0\ -O2 -Wall
没有评论:
发表评论