mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-12 11:10:19 +08:00
fix: optimize time conversion calculations in utils.cpp
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user