Windows Tweaks #691

Merged
gaisser merged 11 commits from eive/fsfw:windows-tweaks-upstream into development 2022-11-14 14:18:49 +01:00
5 changed files with 18 additions and 2 deletions
Showing only changes of commit 68ce8b5b08 - Show all commits

View File

@ -8,6 +8,7 @@
#if defined(PLATFORM_WIN)
#include <sysinfoapi.h>
#define timegm _mkgmtime
gaisser marked this conversation as resolved
Review

Interesting

Interesting
#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;
Review

Have you executed the unittests with the windows version?

Have you executed the unittests with the windows version?
Review

hmm not sure about the unittests, I definitely compiled and ran it on Windows. Might check again.

hmm not sure about the unittests, I definitely compiled and ran it on Windows. Might check again.
Review

Unittests running on Windows with some tweaks

Unittests running on Windows with some tweaks
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"