util: Fix millisecond logging timestamp calculation

Four sub-second digits means 0.1ms units: divide nanoseconds by
10^5, not 10^6.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-08-04 01:39:00 +02:00
parent 539dcf5add
commit a340e5336d

2
util.c
View file

@ -48,7 +48,7 @@ void name(const char *format, ...) { \
tm = gmtime(&tp.tv_sec); \ tm = gmtime(&tp.tv_sec); \
strftime(ts, sizeof(ts), "%b %d %T.", tm); \ strftime(ts, sizeof(ts), "%b %d %T.", tm); \
\ \
fprintf(stderr, "%s%04lu: ", ts, tp.tv_nsec / (1000 * 1000)); \ fprintf(stderr, "%s%04lu: ", ts, tp.tv_nsec / (100 * 1000)); \
va_start(args, format); \ va_start(args, format); \
vsyslog(level, format, args); \ vsyslog(level, format, args); \
va_end(args); \ va_end(args); \