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.
This commit is contained in:
Thomas Haller
2016-09-06 10:56:32 +02:00
parent ee723b2aee
commit c1b4b99a3c

View File

@@ -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