From da493d3b924424328899d1918d628e6ec40c5ad9 Mon Sep 17 00:00:00 2001 From: Michael Orlov Date: Tue, 7 May 2024 09:23:19 -0700 Subject: [PATCH 1/4] Set received_timestamp to steady_clock::now() in message_info Signed-off-by: Michael Orlov --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index 7f47a2d7..a034aec6 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -3279,7 +3279,8 @@ static void message_info_from_sample_info( 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; + message_info->received_timestamp = std::chrono::duration_cast( + std::chrono::steady_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; } From 42c8bc484a5da43e21a2177c3401204e13341d76 Mon Sep 17 00:00:00 2001 From: Michael Orlov Date: Tue, 7 May 2024 11:37:24 -0700 Subject: [PATCH 2/4] Update TODO comment Co-authored-by: Chris Lalancette Signed-off-by: Michael Orlov --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index a034aec6..cdd90714 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -3278,7 +3278,7 @@ 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 + // TODO(iluetkeb) get received_timestamp from Cyclone when implemented there message_info->received_timestamp = std::chrono::duration_cast( std::chrono::steady_clock::now().time_since_epoch()).count(); message_info->publication_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED; From 1d83bb0008812cc75013b4253baf049a12831d62 Mon Sep 17 00:00:00 2001 From: Michael Orlov Date: Tue, 7 May 2024 15:51:13 -0700 Subject: [PATCH 3/4] Use 'system_clock' instead of 'steady_clock' Signed-off-by: Michael Orlov --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index cdd90714..d6a87b28 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -3280,7 +3280,7 @@ static void message_info_from_sample_info( message_info->source_timestamp = info.source_timestamp; // TODO(iluetkeb) get received_timestamp from Cyclone when implemented there message_info->received_timestamp = std::chrono::duration_cast( - std::chrono::steady_clock::now().time_since_epoch()).count(); + 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; } From 3944c4b65e6a7cde26d6e0a8da7fb6366b1dc071 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Wed, 8 May 2024 15:29:04 +0000 Subject: [PATCH 4/4] Also update receive_timestamp for services. Signed-off-by: Chris Lalancette --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index d6a87b28..240a4d98 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -4632,8 +4632,9 @@ static rmw_ret_t rmw_take_response_request( static_cast(&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::system_clock::now().time_since_epoch()).count(); if (source_timestamp) { *source_timestamp = info.source_timestamp; }