hopefully fix Windows build

This commit is contained in:
tildearrow 2022-04-11 02:01:23 -05:00
parent 39784bc7c2
commit d485411727
1 changed files with 9 additions and 0 deletions

View File

@ -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;