microRTPS: timesync: add getters and setter to generalize interface

This commit is contained in:
TSC21
2020-03-11 15:13:07 +00:00
committed by Nuno Marques
parent 7612879ffd
commit 99f96437c3
4 changed files with 85 additions and 20 deletions
+2
View File
@@ -110,6 +110,7 @@ void RtpsTopics::publish(uint8_t topic_ID, char data_buffer[], size_t len)
// apply timestamp offset
uint64_t timestamp = getMsgTimestamp(&st);
_timesync->subtractOffset(timestamp);
setMsgTimestamp(&st, timestamp);
_@(topic)_pub.publish(&st);
@[ if topic == 'Timesync' or topic == 'timesync']@
}
@@ -141,6 +142,7 @@ bool RtpsTopics::getMsg(const uint8_t topic_ID, eprosima::fastcdr::Cdr &scdr)
// apply timestamp offset
uint64_t timestamp = getMsgTimestamp(&msg);
_timesync->addOffset(timestamp);
setMsgTimestamp(&msg, timestamp);
msg.serialize(scdr);
ret = true;
@[ if topic == 'Timesync' or topic == 'timesync']@