fix: optimize time conversion calculations in utils.cpp

This commit is contained in:
ob-yalian
2026-06-11 13:51:14 +08:00
parent 14b62847eb
commit 79668cc5e1
+2 -2
View File
@@ -308,7 +308,7 @@ orbbec_camera_msgs::msg::Extrinsics obExtrinsicsToMsg(const OBD2CTransform &extr
}
rclcpp::Time fromMsToROSTime(uint64_t ms) {
auto total = static_cast<uint64_t>(ms * 1e6);
auto total = ms * 1000000ULL;
uint64_t sec = total / 1000000000;
uint64_t nano_sec = total % 1000000000;
rclcpp::Time stamp(sec, nano_sec);
@@ -316,7 +316,7 @@ rclcpp::Time fromMsToROSTime(uint64_t ms) {
}
rclcpp::Time fromUsToROSTime(uint64_t us) {
auto total = static_cast<uint64_t>(us * 1e3);
auto total = us * 1000ULL;
uint64_t sec = total / 1000000000;
uint64_t nano_sec = total % 1000000000;
rclcpp::Time stamp(sec, nano_sec);