#include "tools.h" #include #include #include using std::string; using std::chrono::duration; string formatDuration(duration seconds) { return fmt::format("{0:.2f}", seconds.count()); } string formatTime(time_t time, const string& format) { tm timeInfo; localtime_s(&timeInfo, &time); std::vector buffer(20); bool success = false; while (!success) { success = strftime(buffer.data(), buffer.size(), format.c_str(), &timeInfo) != 0; if (!success) buffer.resize(buffer.size() * 2); } return string(buffer.data()); }