2022-04-08 11:22:16 +02:00
|
|
|
|
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"
|
2022-04-08 11:22:16 +02:00
|
|
|
#include "fsfw/timemanager/Clock.h"
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2021-07-09 16:57:34 +02:00
|
|
|
void utility::handleSystemError(int retcode, std::string function) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
2022-01-17 15:58:27 +01:00
|
|
|
sif::warning << function << ": System call failed with code " << retcode << ": "
|
|
|
|
<< strerror(retcode) << std::endl;
|
2021-07-09 16:57:34 +02:00
|
|
|
#endif
|
|
|
|
}
|
2022-04-08 11:22:16 +02:00
|
|
|
|
|
|
|
bool utility::timeSanityCheck() {
|
|
|
|
timeval currentTime = {};
|
|
|
|
Clock::getUptime(¤tTime);
|
|
|
|
Clock::TimeOfDay_t currTimeOfDay = {};
|
|
|
|
Clock::convertTimevalToTimeOfDay(¤tTime, &currTimeOfDay);
|
|
|
|
if (currTimeOfDay.year == 2000) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|