35 #include <gtest/gtest.h> 37 TEST(TimeConversion, BytesToTimestamp)
44 uint32_t since_the_hour = ((ros_stamp.
sec % 3600) * 1000000) + ros_stamp.
nsec / 1000;
46 uint8_t native_format[4];
47 native_format[0] = 0xFF & since_the_hour;
48 native_format[1] = 0xFF & (((uint32_t)since_the_hour) >> 8);
49 native_format[2] = 0xFF & (((uint32_t)since_the_hour) >> 16);
50 native_format[3] = 0xFF & (((uint32_t)since_the_hour) >> 24);
54 ASSERT_EQ(ros_stamp_converted.
sec, ros_stamp.
sec);
55 ASSERT_NEAR(ros_stamp_converted.
nsec, ros_stamp.
nsec, 1000);
58 int main(
int argc,
char **argv)
60 ::testing::InitGoogleTest(&argc, argv);
61 int ret = RUN_ALL_TESTS();
TEST(TimeConversion, BytesToTimestamp)
ros::Time rosTimeFromGpsTimestamp(const uint8_t *const data)
int main(int argc, char **argv)