eive-obsw/mission/utility/Timestamp.cpp

23 lines
843 B
C++
Raw Normal View History

2021-12-11 11:56:47 +01:00
#include "Timestamp.h"
2022-01-17 13:48:55 +01:00
2021-12-22 11:20:05 +01:00
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
2021-12-11 11:56:47 +01:00
Timestamp::Timestamp() {
2022-01-17 13:48:55 +01:00
ReturnValue_t result = Clock::getDateAndTime(&time);
if (result != RETURN_OK) {
sif::warning << "Timestamp::Timestamp: Failed to get time" << std::endl;
}
2021-12-11 11:56:47 +01:00
}
2022-01-17 13:48:55 +01:00
Timestamp::~Timestamp() {}
2021-12-11 11:56:47 +01:00
std::string Timestamp::str() {
2022-01-17 13:48:55 +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
}