eive-obsw/mission/utility/Timestamp.cpp

29 lines
998 B
C++
Raw Normal View History

2021-12-11 11:56:47 +01:00
#include "Timestamp.h"
2021-12-22 11:20:05 +01:00
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
2021-12-11 11:56:47 +01:00
Timestamp::Timestamp() {
ReturnValue_t result = Clock::getDateAndTime(&time);
if (result != RETURN_OK) {
sif::warning << "Timestamp::Timestamp: Failed to get time" << std::endl;
}
}
Timestamp::~Timestamp() {
}
std::string Timestamp::str() {
2021-12-23 11:07:19 +01:00
timestamp << std::to_string(time.year) << "-"
<< std::setw(2) << std::setfill('0')
<< std::to_string(time.month) << "-"
<< std::setw(2) << std::setfill('0')
<< std::to_string(time.day) << "--"
<< std::setw(2) << std::setfill('0')
<< std::to_string(time.hour) << "-"
<< std::setw(2) << std::setfill('0')
<< std::to_string(time.minute) << "-"
<< std::setw(2) << std::setfill('0')
<< std::to_string(time.second) << "--";
return timestamp.str();
2021-12-11 11:56:47 +01:00
}