mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 13:40:10 +01:00
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:
parent
ee723b2aee
commit
c1b4b99a3c
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue