From c1b4b99a3c758f320c369a8daadb219eeb50ee83 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 6 Sep 2016 10:56:32 +0200 Subject: [PATCH] logging: don't round subsecond part in logging timestamp tv.tv_usec is guaranteed to have less then 6 digits, however rounding it up we might reach 1000000 and thus the value becomes mis-aligned. To round correctly, we would have to carry over a potential overflow to the seconds. But that seems too much effort for little gain. Just truncate the value. --- src/nm-logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-logging.c b/src/nm-logging.c index 3db8d20cd..6ecc16062 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -512,7 +512,7 @@ _nm_log_impl (const char *file, va_end (args); g_get_current_time (&tv); - nm_sprintf_buf (s_buf_timestamp, " [%ld.%04ld]", tv.tv_sec, (tv.tv_usec + 50) / 100); + nm_sprintf_buf (s_buf_timestamp, " [%ld.%04ld]", tv.tv_sec, tv.tv_usec / 100); switch (global.log_backend) { #if SYSTEMD_JOURNAL