diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb4983b5..46e4a6f33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,7 +100,7 @@ endif() if(CYGWIN OR MSVC OR WIN32) set(Boost_USE_STATIC_LIBS 1) endif() -find_package(Boost 1.40 COMPONENTS serialization system chrono filesystem thread REQUIRED) +find_package(Boost 1.40 COMPONENTS serialization system filesystem thread REQUIRED) # General build settings include_directories( diff --git a/gtsam/base/timing.cpp b/gtsam/base/timing.cpp index 305f86a74..1388c2f18 100644 --- a/gtsam/base/timing.cpp +++ b/gtsam/base/timing.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -152,13 +153,15 @@ const boost::shared_ptr& TimingOutline::child(size_t child, const void TimingOutline::tic() { assert(!timerActive_); timerActive_ = true; - t0_ = clock_t::now(); + gettimeofday(&t0_, NULL); } /* ************************************************************************* */ void TimingOutline::toc() { + struct timeval t; + gettimeofday(&t, NULL); assert(timerActive_); - add(boost::chrono::duration_cast(clock_t::now() - t0_).count()); + add(t.tv_sec*1000000 + t.tv_usec - (t0_.tv_sec*1000000 + t0_.tv_usec)); timerActive_ = false; } @@ -241,11 +244,9 @@ void Timing::print() { /* ************************************************************************* */ double _tic_() { - typedef boost::chrono::high_resolution_clock clock_t; - typedef boost::chrono::duration duration_t; - - clock_t::time_point t = clock_t::now(); - return boost::chrono::duration_cast< duration_t >(t.time_since_epoch()).count(); + struct timeval t; + gettimeofday(&t, NULL); + return ((double)t.tv_sec + ((double)t.tv_usec)/1000000.); } /* ************************************************************************* */ diff --git a/gtsam/base/timing.h b/gtsam/base/timing.h index 56ac1a762..94498c3b3 100644 --- a/gtsam/base/timing.h +++ b/gtsam/base/timing.h @@ -22,7 +22,6 @@ #include #include #include -#include class TimingOutline; extern boost::shared_ptr timingRoot; @@ -30,9 +29,6 @@ extern boost::weak_ptr timingCurrent; class TimingOutline { protected: - typedef boost::chrono::high_resolution_clock clock_t; - typedef boost::chrono::microseconds duration_t; - size_t t_; double t2_ ; /* cache the \sum t_i^2 */ size_t tIt_; @@ -43,7 +39,7 @@ protected: boost::weak_ptr parent_; std::vector > children_; - clock_t::time_point t0_; + struct timeval t0_; bool timerActive_; void add(size_t usecs);