Based on patch by Branden Robinson <[email protected]>
---
 error.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/error.c b/error.c
index d1bd16e..4f5eb6b 100644
--- a/error.c
+++ b/error.c
@@ -64,9 +64,6 @@ LogVWrite(const char *fmt, va_list args)
        va_end(args);           \
     } while(0)
 
-#define LogHeader(type)                \
-    LogAppend("xdm %s (pid %ld): ", type, (long)getpid())
-
 /* Append more text to the log without a new header, right after
    having called LogInfo or LogError */
 void
@@ -75,6 +72,23 @@ LogAppend(const char * fmt, ...)
     LogVarArgsWrite(fmt);
 }
 
+static void
+LogHeader(const char *type) {
+    time_t seconds;
+    size_t rc = 0;
+    struct tm *timestamp = NULL;
+    char timebuf[256];
+    if (time(&seconds) != (time_t) -1)
+       timestamp = localtime(&seconds);
+
+    if (timestamp)
+       rc = strftime(timebuf, 255, "%c", timestamp);
+    if (!rc)
+       strcpy(timebuf, "(time unavailable)");
+
+    LogAppend("%s xdm %s (pid %ld): ", timebuf, type, (long)getpid());
+}
+
 void
 LogInfo(const char * fmt, ...)
 {
-- 
1.6.5.7

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to