/* * Timer.h * * Created on: 21 дек. 2021 г. * Author: alexander */ #pragma once #include class Timer { public: static Timer& getInstance() { static Timer _instance; return _instance; } void start() { m_beg = clock_t::now(); } double end() const { return elapsed() * 1000; } private: using clock_t = std::chrono::high_resolution_clock; using second_t = std::chrono::duration >; std::chrono::time_point m_beg; double elapsed() const { return std::chrono::duration_cast(clock_t::now() - m_beg).count(); } Timer() {} Timer(const Timer&) = delete; Timer& operator=(const Timer&) = delete; Timer& operator=(Timer&&) = delete; };