#include "logger.h" #include namespace logger { std::mutex mut; Timer::Timer() { restart(); } void Timer::restart() { std::chrono::duration(std::chrono::steady_clock::now() .time_since_epoch()).count(); } void Timer::print(std::ostream &os) const { double now = std::chrono::duration(std::chrono::steady_clock::now() .time_since_epoch()).count(); int deltaMs = (int)((now - start_) * 1000); int delta = deltaMs; if (deltaMs > 60 * 1000) { os << (deltaMs / (60 * 1000)) << "m "; delta %= 60 * 1000; } if (deltaMs > 1000) { os << (deltaMs / 1000) << "s "; delta %= 1000; } os << delta << "ms"; } }