#ifndef TIMER_H #define TIMER_H // Custom includes #include class RunTimer { public: void startTimer(); int endTimer(); private: // Aliases using Clock = std::chrono::steady_clock; using TimePoint = std::chrono::time_point; TimePoint startTime; TimePoint endTime; }; #endif // End of header #ifdef TIMER_IMPL #ifndef TIMER_IMPL_H #define TIMER_IMPL_H // Implementation void RunTimer::startTimer(){ startTime = Clock::now(); } int RunTimer::endTimer() { endTime = Clock::now(); auto elapsed = std::chrono::duration_cast(endTime - startTime); return elapsed.count(); } #endif #endif