From 73c4df5e2c01368f468ab0b7c5156888c8ae3fb8 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 20 Feb 2022 23:38:42 -0800 Subject: [PATCH] Fixes for Windows --- src/pc/debuglog.h | 4 ++++ src/pc/logfile.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/pc/debuglog.h b/src/pc/debuglog.h index 66af0e82..f415fba2 100644 --- a/src/pc/debuglog.h +++ b/src/pc/debuglog.h @@ -7,9 +7,13 @@ static void _debuglog_print_timestamp(void) { time_t ltime = time(NULL); +#if defined(_WIN32) + char* str = asctime(localtime(<ime)); +#else struct tm ltime2 = { 0 }; localtime_r(<ime, <ime2); char* str = asctime(<ime2); +#endif printf("%.*s", (int)strlen(str) - 1, str); } diff --git a/src/pc/logfile.h b/src/pc/logfile.h index 99f6eb52..7e1f9387 100644 --- a/src/pc/logfile.h +++ b/src/pc/logfile.h @@ -26,9 +26,13 @@ void logfile_close(enum LogFileType logFileType); static void _logfile_print_timestamp(enum LogFileType logFileType) { FILE* f = gLogFiles[logFileType].file; time_t ltime = time(NULL); +#if defined(_WIN32) + char* str = asctime(localtime(<ime)); +#else struct tm ltime2 = { 0 }; localtime_r(<ime, <ime2); char* str = asctime(<ime2); +#endif fprintf(f, "%.*s", (int)strlen(str) - 1, str); }