diff --git a/base/timer.hpp b/base/timer.hpp index fbcd5b1ac9..6cb5fa0f65 100644 --- a/base/timer.hpp +++ b/base/timer.hpp @@ -1,24 +1,23 @@ #pragma once #include "base.hpp" -#include "../std/ctime.hpp" +#include namespace my { - // TODO: Check std::clock() on iPhone and iPhone Simulator. - - // Cross platform timer. + /// Cross platform timer class Timer { public: - Timer() {Reset();} + Timer() { Reset(); } double ElapsedSeconds() const { - return (clock() - m_StartTime) / static_cast(CLOCKS_PER_SEC); + return (boost::posix_time::microsec_clock::local_time() - m_StartTime).total_milliseconds() + / 1000.0; } - void Reset() { m_StartTime = clock(); } + void Reset() { m_StartTime = boost::posix_time::microsec_clock::local_time(); } private: - clock_t m_StartTime; + boost::posix_time::ptime m_StartTime; }; }