From 27bc8194e72a62102ee58ba2767fcf0087b78028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20L=C3=BCtkebohle?= Date: Thu, 23 Apr 2020 23:29:39 +0200 Subject: [PATCH] Fill in message_info timestamps (#163) * Fill in message_info timestamps Signed-off-by: Luetkebohle Ingo (CR/AEX3) * Report error when timestamp cannot be obtained. Signed-off-by: Luetkebohle Ingo (CR/AEX3) * return 0 for received timestamp to signify lack of support Signed-off-by: Luetkebohle Ingo (CR/AEX3) --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index a9b49543..4e149d32 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -2137,6 +2137,7 @@ static rmw_ret_t rmw_take_int( dds_sample_info_t info; while (dds_take(sub->enth, &ros_message, &info, 1, 1) == 1) { if (info.valid_data) { + *taken = true; if (message_info) { message_info->publisher_gid.implementation_identifier = eclipse_cyclonedds_identifier; memset(message_info->publisher_gid.data, 0, sizeof(message_info->publisher_gid.data)); @@ -2144,6 +2145,9 @@ static rmw_ret_t rmw_take_int( memcpy( 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; } #if REPORT_LATE_MESSAGES > 0 dds_time_t tnow = dds_time(); @@ -2152,7 +2156,6 @@ static rmw_ret_t rmw_take_int( fprintf(stderr, "** sample in history for %.fms\n", static_cast(dt) / 1e6); } #endif - *taken = true; return RMW_RET_OK; } }