Generated by Generative AI
GPT-5.5
Operating System:
ubuntu 22.04
ROS version or commit hash:
humble
RMW implementation (if applicable):
cyclone dds
RMW Configuration (if applicable):
No response
Client library (if applicable):
No response
'ros2 doctor --report' output
Summary
The {date_time_with_ms} logging format token appears to format the millisecond field incorrectly when the nanosecond part of the timestamp has leading zeros.
I checked the Humble implementation, and the Rolling implementation appears to use the same logic.
log example
the timestamp of the second log should be newer than the first log
[INFO 2026-05-27 10:32:52.860] ... [4724] frame_ts:lidar_ts:1779849172000
[INFO 2026-05-27 10:32:52.245] ... [4725] frame_ts:lidar_ts:1779849172100
Affected code
In rcutils_time_point_value_as_date_string():
uint64_t nanoseconds = abs_time_point % (1000u * 1000u * 1000u);
char nanoseconds_str[21];
rcutils_snprintf(nanoseconds_str, sizeof(nanoseconds_str), "%" PRIu64, nanoseconds);
rcutils_snprintf(
&str[date_end_position], str_size - date_end_position, ".%.3s",
nanoseconds_str)
### Steps to reproduce issue
export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {date_time_with_ms}] [{name}@{function_name}:{line_number}]: {message}"
### Expected behavior
The nanosecond remainder should be zero-padded to 9 digits before extracting milliseconds, or milliseconds should be computed directly:
```c
uint64_t milliseconds = nanoseconds / (1000u * 1000u);
and formatted as:
Actual behavior
the ts of LiDAR are increasing but the ts of logger are decreasing;
[INFO 2026-05-27 10:32:52.860] ... [4724] frame_ts:lidar_ts:1779849172000
[INFO 2026-05-27 10:32:52.245] ... [4725] frame_ts:lidar_ts:1779849172100
Additional information
No response
Generated by Generative AI
GPT-5.5
Operating System:
ubuntu 22.04
ROS version or commit hash:
humble
RMW implementation (if applicable):
cyclone dds
RMW Configuration (if applicable):
No response
Client library (if applicable):
No response
'ros2 doctor --report' output
Summary
The
{date_time_with_ms}logging format token appears to format the millisecond field incorrectly when the nanosecond part of the timestamp has leading zeros.I checked the Humble implementation, and the Rolling implementation appears to use the same logic.
log example
the timestamp of the second log should be newer than the first log
Affected code
In
rcutils_time_point_value_as_date_string():and formatted as:
Actual behavior
the ts of LiDAR are increasing but the ts of logger are decreasing;
Additional information
No response