10 virtual ~Clock() =
default;
12 virtual std::time_t getTime() {
13 std::time_t beginTime = std::time(
nullptr);
18inline void localtime_platform(
const std::time_t &time_p,
19 struct tm &local_time) {
20#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
21 localtime_s(&local_time, &time_p);
23 localtime_r(&time_p, &local_time);
26namespace clock_utils {
27inline std::string timeToStr(
const std::time_t &time_p) {
29 localtime_platform(time_p, local_time);
31 const char *FORMAT =
"%d-%m-%Y %H:%M:%S";
33 strftime(buffer_l,
sizeof(buffer_l), FORMAT, &local_time);
34 std::string strTime_l(buffer_l);