summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-08-05 14:06:36 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-08-05 14:09:45 +0100
commitfca5cb18a75fef98293e4afdc1d5fcad45230818 (patch)
treeb15ad8d138510d541d3e4565944e88a04d22be2e /src
parent32dfdf8baa8ccf091a0d5d4d75e8627424898756 (diff)
Debugging: millisecond timestamps. Bug 2102
Diffstat (limited to 'src')
-rw-r--r--src/src/debug.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/src/debug.c b/src/src/debug.c
index 8c414d0f9..f6c8b2f62 100644
--- a/src/src/debug.c
+++ b/src/src/debug.c
@@ -182,10 +182,16 @@ if (debug_ptr == debug_buffer)
{
DEBUG(D_timestamp)
{
- time_t now = time(NULL);
- struct tm *t = timestamps_utc? gmtime(&now) : localtime(&now);
- debug_ptr += sprintf(CS debug_ptr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min,
- t->tm_sec);
+ struct timeval now;
+ time_t tmp;
+ struct tm * t;
+
+ gettimeofday(&now, NULL);
+ tmp = now.tv_sec;
+ t = timestamps_utc ? gmtime(&now) : localtime(&now);
+ debug_ptr += sprintf(CS debug_ptr,
+ LOGGING(millisec) ? "%02d:%02d:%02d.%03d " : "%02d:%02d:%02d ",
+ t->tm_hour, t->tm_min, t->tm_sec, now.tv_usec/1000);
}
DEBUG(D_pid)