X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdebug.c;h=09e03f1e499f81a9476a6ce279af089803ed631e;hb=1b7cf216d933b395dee691f05becca4dd44b26f7;hp=35571547f656ed6c465509d6da102d357ab89ff1;hpb=f9913671b40a2107bfbcc3b7fcf5823c5771eb42;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/debug.c b/src/src/debug.c index 35571547f..09e03f1e4 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -182,17 +182,21 @@ if (debug_ptr == debug_buffer) { DEBUG(D_timestamp) { - time_t now = time(NULL); - struct tm *t = timestamps_utc? gmtime(&now) : localtime(&now); - (void) sprintf(CS debug_ptr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, - t->tm_sec); - while(*debug_ptr != 0) debug_ptr++; + struct timeval now; + time_t tmp; + struct tm * t; + + gettimeofday(&now, NULL); + tmp = now.tv_sec; + t = timestamps_utc ? gmtime(&tmp) : localtime(&tmp); + debug_ptr += sprintf(CS debug_ptr, + LOGGING(millisec) ? "%02d:%02d:%02d.%03d " : "%02d:%02d:%02d ", + t->tm_hour, t->tm_min, t->tm_sec, (int)(now.tv_usec/1000)); } DEBUG(D_pid) { - sprintf(CS debug_ptr, "%5d ", (int)getpid()); - while(*debug_ptr != 0) debug_ptr++; + debug_ptr += sprintf(CS debug_ptr, "%5d ", (int)getpid()); } /* Set up prefix if outputting for host checking and not debugging */