Skip to content

Commit

Permalink
Set received_timestamp to system_clock::now() in message_info (#491)
Browse files Browse the repository at this point in the history
* Set received_timestamp to steady_clock::now() in message_info

* Use 'system_clock' instead of 'steady_clock'

* Also update receive_timestamp for services.

Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
MichaelOrlov authored May 9, 2024
1 parent c6dbe24 commit 76c9d8f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rmw_cyclonedds_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3278,8 +3278,9 @@ static void message_info_from_sample_info(
message_info->publisher_gid.data, &info.publication_handle,
sizeof(info.publication_handle));
message_info->source_timestamp = info.source_timestamp;
// TODO(iluetkeb) add received timestamp, when implemented by Cyclone
message_info->received_timestamp = 0;
// TODO(iluetkeb) get received_timestamp from Cyclone when implemented there
message_info->received_timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
message_info->publication_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED;
message_info->reception_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED;
}
Expand Down Expand Up @@ -4631,8 +4632,9 @@ static rmw_ret_t rmw_take_response_request(
static_cast<const void *>(&info.publication_handle), sizeof(info.publication_handle));
request_header->request_id.sequence_number = wrap.header.seq;
request_header->source_timestamp = info.source_timestamp;
// TODO(iluetkeb) replace with real received timestamp when available in cyclone
request_header->received_timestamp = 0;
// TODO(iluetkeb) get received_timestamp from Cyclone when implemented there
request_header->received_timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
if (source_timestamp) {
*source_timestamp = info.source_timestamp;
}
Expand Down

0 comments on commit 76c9d8f

Please sign in to comment.