1 // timer.cpp : 定义控制台应用程序的入口点。
 2 //
 3 
 4 #include "stdafx.h"
 5 #include <iostream>
 6 #include <boost/timer.hpp>
 7 #include <boost/progress.hpp>
 8 #include <boost/date_time.hpp>
 9 
10 using namespace std;
11 /*记时器*/
12 void timer()
13 {
14     boost::timer t;
15     cout << t.elapsed_max() << endl;
16     cout << t.elapsed_min() << endl;
17     cout << t.elapsed() << endl;
18     t.restart();
19     cout << t.elapsed() << endl;
20 }
21 /*记时器*/
22 void progress_timer()
23 {
24     boost::progress_timer t;
25     cout << t.elapsed_max() << endl;
26     cout << t.elapsed_min() << endl;
27     cout << t.elapsed() << endl;
28     t.restart();
29     cout << t.elapsed() << endl;
30 }
31 /*输出当前时间*/
32 void current_time()
33 {
34     boost::posix_time::ptime t=boost::posix_time::second_clock::local_time();
35     cout<< t <<endl;
36 }
37 int _tmain(int argc, _TCHAR* argv[])
38 {
39 //    timer();
40 //    progress_timer();
41     current_time();
42     return 0;
43 }

 

相关文章: