From 5c57ba926a40366b8da3d109ae636738be870979 Mon Sep 17 00:00:00 2001 From: Shafeeq E T Date: Wed, 12 Jul 2023 16:05:25 -0500 Subject: [PATCH] Wrong nsec value in Image header timestamp GetTimestamp() returns uint64 value and inorder to get nsec(a type of int) for header.stamp, you need to take modulus (%) --- spinnaker_camera_driver/src/SpinnakerCamera.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spinnaker_camera_driver/src/SpinnakerCamera.cpp b/spinnaker_camera_driver/src/SpinnakerCamera.cpp index 3ecaac9f..74a559e7 100644 --- a/spinnaker_camera_driver/src/SpinnakerCamera.cpp +++ b/spinnaker_camera_driver/src/SpinnakerCamera.cpp @@ -358,8 +358,9 @@ void SpinnakerCamera::grabImage(sensor_msgs::Image* image, const std::string& fr } // Set Image Time Stamp - image->header.stamp.sec = image_ptr->GetTimeStamp() * 1e-9; - image->header.stamp.nsec = image_ptr->GetTimeStamp(); + uint64_t time_stamp = image_ptr->GetTimeStamp(); + image->header.stamp.sec = time_stamp * 1e-9; + image->header.stamp.nsec = time_stamp % 1e9; // Check the bits per pixel. size_t bitsPerPixel = image_ptr->GetBitsPerPixel();