diff --git a/fastdds_python/src/swig/fastdds/rtps/common/Time_t.i b/fastdds_python/src/swig/fastdds/rtps/common/Time_t.i index 3122c6ad..e5321b2c 100644 --- a/fastdds_python/src/swig/fastdds/rtps/common/Time_t.i +++ b/fastdds_python/src/swig/fastdds/rtps/common/Time_t.i @@ -13,14 +13,14 @@ // limitations under the License. %{ -#include "fastdds/rtps/common/Time_t.h" +#include %} // There are two definitions of Time_t in different namespaces // As SWIG flattens the namespaces, we cannot have two classes with the same name // We remove the one that is not used in the user API // We also remove all the related operators -%ignore eprosima::fastrtps::rtps::Time_t; +%rename(RTPSTime_t) eprosima::fastrtps::rtps::Time_t; %ignore eprosima::fastrtps::rtps::operator==(const Time_t&, const Time_t&); %ignore eprosima::fastrtps::rtps::operator!=(const Time_t&, const Time_t&); %ignore eprosima::fastrtps::rtps::operator<(const Time_t&, const Time_t&); @@ -48,7 +48,7 @@ %ignore eprosima::fastrtps::operator+(const Time_t&, const Time_t&); %ignore eprosima::fastrtps::operator-(const Time_t&, const Time_t&); -%include "fastdds/rtps/common/Time_t.h" +%include // Declare the comparison operators as internal to the class %extend eprosima::fastrtps::Time_t { diff --git a/fastdds_python/test/api/test_datareader.py b/fastdds_python/test/api/test_datareader.py index 3222b99d..452dd588 100644 --- a/fastdds_python/test/api/test_datareader.py +++ b/fastdds_python/test/api/test_datareader.py @@ -537,6 +537,8 @@ def test_read(transient_datareader_qos, datareader, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.int16_field() == data_seq[0].int16_field()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -575,6 +577,8 @@ def test_read_instance(transient_datareader_qos, test_keyed_type, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.id() == data_seq[0].id()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -612,6 +616,8 @@ def test_read_next_instance(transient_datareader_qos, test_keyed_type, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.id() == data_seq[0].id()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -638,6 +644,8 @@ def test_read_next_sample(transient_datareader_qos, datareader, assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.read_next_sample(data, info)) assert(info.valid_data) + assert(0 < info.source_timestamp.to_ns()) + assert(0 < info.reception_timestamp.to_ns()) assert(sample.int16_field() == data.int16_field()) @@ -671,6 +679,8 @@ def test_take(transient_datareader_qos, datareader, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.int16_field() == data_seq[0].int16_field()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -709,6 +719,8 @@ def test_take_instance(transient_datareader_qos, test_keyed_type, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.id() == data_seq[0].id()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -746,6 +758,8 @@ def test_take_next_instance(transient_datareader_qos, test_keyed_type, assert(1 == len(data_seq)) assert(1 == len(info_seq)) assert(info_seq[0].valid_data is True) + assert(0 < info_seq[0].source_timestamp.to_ns()) + assert(0 < info_seq[0].reception_timestamp.to_ns()) assert(sample.id() == data_seq[0].id()) assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.return_loan(data_seq, info_seq)) @@ -772,6 +786,8 @@ def test_take_next_sample(transient_datareader_qos, datareader, assert(fastdds.ReturnCode_t.RETCODE_OK == datareader.take_next_sample(data, info)) assert(info.valid_data) + assert(0 < info.source_timestamp.to_ns()) + assert(0 < info.reception_timestamp.to_ns()) assert(sample.int16_field() == data.int16_field())