diff --git a/src/common/Log.cpp b/src/common/Log.cpp index 08e6c5c8..90239155 100644 --- a/src/common/Log.cpp +++ b/src/common/Log.cpp @@ -99,7 +99,7 @@ static bool LogOpen() time_t now; ::time(&now); - struct tm* tm = ::gmtime(&now); + struct tm* tm = ::localtime(&now); if (tm->tm_mday == m_tm.tm_mday && tm->tm_mon == m_tm.tm_mon && tm->tm_year == m_tm.tm_year) { if (m_fpLog != nullptr) @@ -223,16 +223,18 @@ void Log(uint32_t level, const char *module, const char* fmt, ...) #endif char buffer[LOG_BUFFER_LEN]; if (!g_disableTimeDisplay && !g_useSyslog) { - struct timeval now; - ::gettimeofday(&now, NULL); + time_t now; + ::time(&now); + struct tm* tm = ::localtime(&now); - struct tm* tm = ::gmtime(&now.tv_sec); + struct timeval nowMillis; + ::gettimeofday(&nowMillis, NULL); if (module != nullptr) { - ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, now.tv_usec / 1000U, module); + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu (%s) ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, module); } else { - ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, now.tv_usec / 1000U); + ::sprintf(buffer, "%c: %04d-%02d-%02d %02d:%02d:%02d.%03lu ", LEVELS[level], tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U); } } else { diff --git a/src/dfsi/ActivityLog.cpp b/src/dfsi/ActivityLog.cpp index 0db4446f..7575051a 100644 --- a/src/dfsi/ActivityLog.cpp +++ b/src/dfsi/ActivityLog.cpp @@ -63,7 +63,7 @@ static bool ActivityLogOpen() time_t now; ::time(&now); - struct tm* tm = ::gmtime(&now); + struct tm* tm = ::localtime(&now); if (tm->tm_mday == m_actTm.tm_mday && tm->tm_mon == m_actTm.tm_mon && tm->tm_year == m_actTm.tm_year) { if (m_actFpLog != nullptr) diff --git a/src/fne/ActivityLog.cpp b/src/fne/ActivityLog.cpp index 1d923c5f..a85f3a7e 100644 --- a/src/fne/ActivityLog.cpp +++ b/src/fne/ActivityLog.cpp @@ -57,7 +57,7 @@ static bool ActivityLogOpen() time_t now; ::time(&now); - struct tm* tm = ::gmtime(&now); + struct tm* tm = ::localtime(&now); if (tm->tm_mday == m_actTm.tm_mday && tm->tm_mon == m_actTm.tm_mon && tm->tm_year == m_actTm.tm_year) { if (m_actFpLog != nullptr) diff --git a/src/host/ActivityLog.cpp b/src/host/ActivityLog.cpp index 544202f1..651ed7a5 100644 --- a/src/host/ActivityLog.cpp +++ b/src/host/ActivityLog.cpp @@ -62,7 +62,7 @@ static bool ActivityLogOpen() time_t now; ::time(&now); - struct tm* tm = ::gmtime(&now); + struct tm* tm = ::localtime(&now); if (tm->tm_mday == m_actTm.tm_mday && tm->tm_mon == m_actTm.tm_mon && tm->tm_year == m_actTm.tm_year) { if (m_actFpLog != nullptr)