diff --git a/emper/log/log.cpp b/emper/log/log.cpp index c35997315ced171bc9b24fd0b20429f907594ff5..b975f1d9cd8b61d9331e512fd9b168d3516a214e 100644 --- a/emper/log/log.cpp +++ b/emper/log/log.cpp @@ -24,12 +24,10 @@ using emper::io::GlobalIoContext; namespace emper::log { static void add_timestamp_to(std::ostringstream& logMessage) { -#if defined __GLIBCXX__ - static const long NanosInAMinute = 60L * 1000 * 1000 * 1000; + using clock = std::chrono::system_clock; - auto now = std::chrono::high_resolution_clock::now(); - - auto now_time_t = std::chrono::high_resolution_clock::to_time_t(now); + auto now = clock::now(); + auto now_time_t = clock::to_time_t(now); const std::tm* now_localtime = [&now_time_t] { if constexpr (emper::LOG_TIMESTAMP == emper::LogTimeStamp::utc) { @@ -52,11 +50,9 @@ static void add_timestamp_to(std::ostringstream& logMessage) { auto time_since_epoch = now_nanos.time_since_epoch(); long time_since_epoch_long = time_since_epoch.count(); + const long NanosInAMinute = 60L * 1000 * 1000 * 1000; long remaining_nanos = time_since_epoch_long % NanosInAMinute; logMessage << remaining_nanos; -#else - logMessage << "UNKN_TIME"; -#endif } static std::mutex log_mutex;