tweaks to make windows build again

This commit is contained in:
Robin Müller 2022-09-27 21:46:11 +02:00
parent 62f638a3d2
commit 68ce8b5b08
5 changed files with 18 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#if defined(PLATFORM_WIN)
#include <sysinfoapi.h>
#define timegm _mkgmtime
#elif defined(PLATFORM_UNIX)
#include <fstream>
#endif

View File

@ -1,6 +1,7 @@
#include "fsfw/osal/windows/winTaskHelpers.h"
#include <mutex>
#include <windows.h>
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);

View File

@ -1,10 +1,12 @@
#include <map>
#include <thread>
#include "../../tasks/TaskFactory.h"
#include "fsfw/tasks/TaskFactory.h"
#ifdef _WIN32
#include <minwindef.h>
namespace tasks {
enum PriorityClass : uint16_t {

View File

@ -61,10 +61,16 @@ ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t*
if (result != returnvalue::OK) {
return result;
}
MutexGuard helper(timeMutex);
// gmtime writes its output in a global buffer which is not Thread Safe
// Therefore we have to use a Mutex here
MutexGuard helper(timeMutex);
#ifdef PLATFORM_WIN
time_t time;
time = from->tv_sec;
timeInfo = gmtime(&time);
#else
timeInfo = gmtime(&from->tv_sec);
#endif
to->year = timeInfo->tm_year + 1900;
to->month = timeInfo->tm_mon + 1;
to->day = timeInfo->tm_mday;

View File

@ -2,6 +2,12 @@
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
#include <cstdlib>
#include "fsfw/platform.h"
#ifdef PLATFORM_WIN
// wtf? Required for timeval!
#include <winsock.h>
#endif
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"