fsfw/timemanager/TimeStamper.cpp

24 lines
582 B
C++
Raw Normal View History

2020-09-16 19:37:17 +02:00
#include "TimeStamper.h"
#include "Clock.h"
2020-09-16 19:36:15 +02:00
#include <cstring>
TimeStamper::TimeStamper(object_id_t objectId): SystemObject(objectId) {}
ReturnValue_t TimeStamper::addTimeStamp(uint8_t* buffer,
const uint8_t maxSize) {
if(maxSize < TimeStamperIF::MISSION_TIMESTAMP_SIZE){
return HasReturnvaluesIF::RETURN_FAILED;
}
timeval now;
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
ReturnValue_t result = CCSDSTime::convertToCcsds(&cds,&now);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
2020-09-16 19:37:17 +02:00
std::memcpy(buffer,&cds,sizeof(cds));
2020-09-16 19:36:15 +02:00
return result;
}