eive-obsw/linux/utility/utility.cpp

28 lines
696 B
C++
Raw Normal View History

2021-07-09 16:57:34 +02:00
#include "utility.h"
2021-07-23 18:20:01 +02:00
#include <cstring>
2021-07-09 16:57:34 +02:00
2022-01-17 15:58:27 +01:00
#include "FSFWConfig.h"
#include "OBSWConfig.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/timemanager/Clock.h"
2022-01-17 15:58:27 +01:00
2022-09-26 12:26:08 +02:00
void utility::handleSystemError(int retcode, std::string context) {
2021-07-09 16:57:34 +02:00
#if OBSW_VERBOSE_LEVEL >= 1
2022-09-26 12:26:08 +02:00
sif::warning << context << ": System call failed with code " << retcode << ": "
2022-01-17 15:58:27 +01:00
<< strerror(retcode) << std::endl;
2021-07-09 16:57:34 +02:00
#endif
}
bool utility::timeSanityCheck() {
timeval currentTime = {};
Clock::getUptime(&currentTime);
Clock::TimeOfDay_t currTimeOfDay = {};
Clock::convertTimevalToTimeOfDay(&currentTime, &currTimeOfDay);
if (currTimeOfDay.year == 2000) {
return false;
}
return true;
}