Skip to content

Commit 5851a88

Browse files
committed
cras_cpp_common: string_utils: Fixed pretty-printing time values on GCC 11 + fmt 9.x.
1 parent 184803a commit 5851a88

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cras_cpp_common/src/string_utils/rclcpp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ std::string to_pretty_string(const rclcpp::Time& value)
219219
else
220220
{
221221
secStr = secStr.substr(0, 2); // get only the seconds part
222-
secStr = cras::format("{0}.{1:06}", secStr, nsec);
222+
const auto subsecStr = cras::format("{0:06}", nsec);
223+
secStr = cras::format("{0}.{1:.6}", secStr, subsecStr); // use only first 6 digits from subsec
223224
}
224225
}
225226
else

0 commit comments

Comments
 (0)