diff --git a/rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp b/rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp index 85f5c51a0..b48289274 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp @@ -462,9 +462,9 @@ void SequentialWriter::write_messages( if (storage_options_.snapshot_mode) { // Update FileInformation about the last file in metadata in case of snapshot mode const auto first_msg_timestamp = std::chrono::time_point( - std::chrono::nanoseconds(messages.front()->recv_timestamp)); + std::chrono::nanoseconds(messages.front()->time_stamp)); const auto last_msg_timestamp = std::chrono::time_point( - std::chrono::nanoseconds(messages.back()->recv_timestamp)); + std::chrono::nanoseconds(messages.back()->time_stamp)); metadata_.files.back().starting_time = first_msg_timestamp; metadata_.files.back().duration = last_msg_timestamp - first_msg_timestamp; metadata_.files.back().message_count = messages.size(); diff --git a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp index 51f5da10d..dab1d31ef 100644 --- a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp +++ b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_writer.cpp @@ -529,8 +529,7 @@ TEST_F(SequentialWriterTest, snapshot_writes_to_new_file_with_bag_split) std::vector messages; for (size_t i = 0; i < num_msgs_to_write; i++) { auto message = std::make_shared(); - message->recv_timestamp = first_msg_timestamp + static_cast(i); - message->send_timestamp = first_msg_timestamp + static_cast(i); + message->time_stamp = first_msg_timestamp + static_cast(i); message->topic_name = topic_name; message->serialized_data = rosbag2_storage::make_serialized_message(msg_content.c_str(), msg_content.length()); @@ -540,7 +539,7 @@ TEST_F(SequentialWriterTest, snapshot_writes_to_new_file_with_bag_split) // Expect a single write call when the snapshot is triggered EXPECT_CALL( *storage_, write( - An> &>()) + An> &>()) ).Times(1); ON_CALL( @@ -629,7 +628,7 @@ TEST_F(SequentialWriterTest, snapshot_writes_to_new_file_with_bag_split) EXPECT_EQ(first_file_info.message_count, num_expected_msgs); EXPECT_EQ( std::chrono::time_point_cast( - first_file_info.starting_time).time_since_epoch().count(), + first_file_info.starting_time).time_since_epoch().count(), expected_start_time); EXPECT_EQ(first_file_info.duration.count(), expected_duration); } @@ -644,7 +643,7 @@ TEST_F(SequentialWriterTest, snapshot_can_be_called_twice) // Expect to call write method twice. Once per each snapshot. EXPECT_CALL( *storage_, write( - An> &>()) + An> &>()) ).Times(2); ON_CALL(*storage_, get_relative_file_path).WillByDefault(