diff --git a/os/log.c b/os/log.c index 4bd6b7e9a..e15823046 100644 --- a/os/log.c +++ b/os/log.c @@ -612,8 +612,20 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) #endif } else if (!inSignalContext && logFile) { - if (newline) - fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0); + if (newline) { + time_t t = time(NULL); + struct tm tm; + char fmt_tm[32]; + +#ifdef WIN32 + localtime_s(&tm, &t); +#else + localtime_r(&t, &tm); +#endif + strftime(fmt_tm, sizeof(fmt_tm) - 1, "%Y-%m-%d %H:%M:%S", &tm); + + fprintf(logFile, "[%s] ", fmt_tm); + } newline = end_line; fwrite(buf, len, 1, logFile); if (logFlush) {