This patch is used to implement optional logfile entry timestamps.
This option is specified through an environment variable.
Index: quilt-distcc-3.1/distcc-3.1/src/trace.c
===================================================================
--- quilt-distcc-3.1.orig/distcc-3.1/src/trace.c
+++ quilt-distcc-3.1/distcc-3.1/src/trace.c
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <syslog.h>
+#include <time.h>
#include "trace.h"
#include "snprintf.h"
@@ -319,6 +320,26 @@ rs_logger_file(int flags, const char *fn
/* NOTE NO TRAILING NUL */
char buf[4090];
size_t len;
+ char timebuf[128];
+ size_t timebuflen;
+ time_t now;
+ struct tm *timestamp;
+ char *timestamp_opt;
+
+ if ((timestamp_opt = getenv("DISTCC_TIMESTAMP"))) {
+ if (*timestamp_opt == '1') {
+ now = time(NULL);
+
+ if ((timestamp = localtime(&now)) != NULL) {
+ timebuflen = strftime(timebuf, 128, "%F %T ", timestamp);
+ } else {
+ strcpy(timebuf, "localtime() NULL??? ");
+ timebuflen = strlen(timebuf);
+ }
+
+ (void) write(log_fd, timebuf, timebuflen);
+ }
+ }
rs_format_msg(buf, sizeof buf, flags, fn, fmt, va);
Index: quilt-distcc-3.1/distcc-3.1/man/distcc.1
===================================================================
--- quilt-distcc-3.1.orig/distcc-3.1/man/distcc.1
+++ quilt-distcc-3.1/distcc-3.1/man/distcc.1
@@ -820,6 +820,9 @@ If set to 1, peform GSS-API based mutual
.B "DISTCC_PRINCIPAL"
If set, specifies the name of the principal that distccd runs under, and is used
to authenticate the server to the client.
+.TP
+.B "DISTCC_TIMESTAMP"
+If set to 1, include timestamps for logfile entries.
.SH "CROSS COMPILING"
Cross compilation means building programs to run on a
machine with a different processor, architecture, or
Index: quilt-distcc-3.1/distcc-3.1/man/distccd.1
===================================================================
--- quilt-distcc-3.1.orig/distcc-3.1/man/distccd.1
+++ quilt-distcc-3.1/distcc-3.1/man/distccd.1
@@ -301,6 +301,9 @@ Directory for temporary files such as pr
.B "DISTCCD_PRINCIPAL"
If set, specifies the name of the principal that distccd runs under, and is used
to authenticate with the client.
+.TP
+.B "DISTCC_TIMESTAMP"
+If set to 1, include timestamps for logfile entries.
.SH "SEE ALSO"
\fBdistcc\fR(1), \fBpump\fR(1), \fBinclude_server\fR(1), \fBgcc\fR(1),
\fBmake\fR(1), and \fBccache\fR(1)