From d485411727dd744f0791f480feebde94db502411 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 11 Apr 2022 02:01:23 -0500 Subject: [PATCH] hopefully fix Windows build --- src/log.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/log.cpp b/src/log.cpp index d0ea0603f..7f7fae8a9 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -97,9 +97,18 @@ int writeLog(int level, const char* msg, fmt::printf_args& args) { logEntries[pos].text=fmt::vsprintf(msg,args); // why do I have to pass a pointer // can't I just pass the time_t directly?! +#ifdef _WIN32 + struct tm* tempTM=localtime(&thisMakesNoSense); + if (tempTM==NULL) { + memset(&logEntries[pos].time,0,sizeof(struct tm)); + } else { + memcpy(&logEntries[pos].time,tempTM,sizeof(struct tm)); + } +#else if (localtime_r(&thisMakesNoSense,&logEntries[pos].time)==NULL) { memset(&logEntries[pos].time,0,sizeof(struct tm)); } +#endif logEntries[pos].loglevel=level; logEntries[pos].ready=true;