eive-obsw/linux/utility/utility.cpp

28 lines
698 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
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
}
bool utility::timeSanityCheck() {
timeval currentTime = {};
Clock::getUptime(&currentTime);
Clock::TimeOfDay_t currTimeOfDay = {};
Clock::convertTimevalToTimeOfDay(&currentTime, &currTimeOfDay);
if (currTimeOfDay.year == 2000) {
return false;
}
return true;
}