aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-25 12:04:52 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-25 12:04:52 +0000
commit3e79693e3bc0f1848b6fa83303c89b79db5f0935 (patch)
treec44f1407fab4963198f42ef5fd4645bc6aed6b59 /tests/server
parentd55d3c2fd0aa646a8c35e3be75ad1b90b1ce9a1c (diff)
utilize the whole usec in the log and don't output to stderr if the logfile
can't be opened
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/server/util.c b/tests/server/util.c
index d88f7ef1e..2b68971a1 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -81,20 +81,19 @@ void logmsg(const char *msg, ...)
struct tm *now =
localtime(&tv.tv_sec); /* not multithread safe but we don't care */
- char timebuf[12];
- snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%02ld",
- now->tm_hour, now->tm_min, now->tm_sec,
- tv.tv_usec/10000);
+ char timebuf[20];
+ snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
+ now->tm_hour, now->tm_min, now->tm_sec, tv.tv_usec);
va_start(ap, msg);
vsprintf(buffer, msg, ap);
va_end(ap);
logfp = fopen(serverlogfile, "a");
- fprintf(logfp?logfp:stderr, /* write to stderr if the logfile doesn't open */
- "%s %s\n", timebuf, buffer);
- if(logfp)
+ if(logfp) {
+ fprintf(logfp, "%s %s\n", timebuf, buffer);
fclose(logfp);
+ }
}
#if defined(WIN32) && !defined(__CYGWIN__)