#pragma once #include "tl/detail/prologue.h" #include namespace tl { using namespace eastl; namespace chrono { using namespace eastl::chrono; template class TL_API chrono final { public: //! Reset the internal time stamp. If you specify an elapsed time offset it will affect directly to getElapsed. void reset(typename Clock::duration elapsed_offset = Clock::duration::zero()) noexcept { m_start_time_point = Clock::now() + elapsed_offset; } //! Return the time passed between the last Reset call and now. typename Clock::duration get_elapsed() const noexcept { return Clock::now() - m_start_time_point; } //! Return the time passed between the last Reset call and now and then Reset the Clock. typename Clock::duration get_elapsed_and_reset() noexcept { auto now = Clock::now(); auto d = now - m_start_time_point; m_start_time_point = now; return d; } private: typename Clock::time_point m_start_time_point = Clock::now(); }; using system_chrono = chrono; using high_resolution_chrono = chrono; } }