2020-08-13 20:53:35 +02:00
|
|
|
#include "TimeMessage.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
TimeMessage::TimeMessage() {
|
2018-07-12 16:29:32 +02:00
|
|
|
this->messageSize += sizeof(timeval) + sizeof(uint32_t);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
TimeMessage::TimeMessage(timeval setTime, uint32_t CounterValue) {
|
2016-06-15 23:48:41 +02:00
|
|
|
memcpy (this->getData(), &setTime, sizeof(timeval));
|
2018-07-12 16:29:32 +02:00
|
|
|
this->messageSize += sizeof(timeval) + sizeof(uint32_t);
|
|
|
|
memcpy (this->getData() + sizeof(timeval), &CounterValue, sizeof(uint32_t));
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TimeMessage::~TimeMessage() {
|
|
|
|
}
|
|
|
|
|
|
|
|
timeval TimeMessage::getTime() {
|
|
|
|
timeval temp;
|
|
|
|
memcpy( &temp, this->getData(), sizeof(timeval));
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
uint32_t TimeMessage::getCounterValue() {
|
|
|
|
uint32_t temp;
|
|
|
|
memcpy ( &temp, this->getData() + sizeof(timeval), sizeof(uint32_t));
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
2021-04-11 18:36:24 +02:00
|
|
|
size_t TimeMessage::getMinimumMessageSize() const {
|
2016-06-15 23:48:41 +02:00
|
|
|
return this->MAX_SIZE;
|
|
|
|
}
|