File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -4,33 +4,28 @@ namespace ipx {
44
55Timer::Timer (const double offset)
66 : offset_(offset) {
7- if (offset_) printf (" Timer::Timer offset_ = %g\n " , offset_);
87 Reset (true );
9- if (offset_) printf (" Timer::Timer offset_ = %g\n " , offset_);
108}
119
1210double Timer::Elapsed () const {
1311 return toc (t0_);
1412}
1513
1614void Timer::Reset (const bool first) {
17- using namespace std ::chrono;
18- double prev_offset = offset_;
1915 if (!first)
2016 offset_ -= duration_cast<duration<double >>(t0_.time_since_epoch ()).count ();
2117 t0_ = tic ();
2218 if (!first)
2319 offset_ += duration_cast<duration<double >>(t0_.time_since_epoch ()).count ();
24- if (offset_) printf (" Timer::Reset offset goes from %g to %g\n " , prev_offset, offset_);
2520}
2621
2722Timer::TimePoint Timer::tic () {
28- return std::chrono:: high_resolution_clock::now ();
23+ return high_resolution_clock::now ();
2924}
3025
3126double Timer::toc (TimePoint start) {
3227 TimePoint end = tic ();
33- std::chrono:: duration<double > diff = end-start;
28+ duration<double > diff = end-start;
3429 return diff.count ();
3530}
3631
Original file line number Diff line number Diff line change 44#include < chrono>
55
66namespace ipx {
7+ using namespace std ::chrono;
78
89class Timer {
910public:
@@ -12,8 +13,7 @@ class Timer {
1213 void Reset (const bool first = false );
1314
1415private:
15- typedef std::chrono::time_point<std::chrono::high_resolution_clock>
16- TimePoint;
16+ typedef time_point<high_resolution_clock> TimePoint;
1717 static TimePoint tic ();
1818 static double toc (TimePoint start);
1919 TimePoint t0_;
You can’t perform that action at this time.
0 commit comments