xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Dec 17 19:42:19 UTC 2023
os/log.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 0df31f068d069b846f98b2164789adde3ebadf83
Author: Zoltán Böszörményi <zboszor at gmail.com>
Date: Wed Sep 20 10:19:31 2023 +0200
Use log lines prefixed with human readable time
Fixes: #399
Signed-off-by: Zoltán Böszörményi <zboszor at gmail.com>
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) {
More information about the xorg-commit
mailing list