Fixes for Windows

This commit is contained in:
MysterD 2022-02-20 23:38:42 -08:00
parent c6bbe0285c
commit 73c4df5e2c
2 changed files with 8 additions and 0 deletions

View File

@ -7,9 +7,13 @@
static void _debuglog_print_timestamp(void) {
time_t ltime = time(NULL);
#if defined(_WIN32)
char* str = asctime(localtime(&ltime));
#else
struct tm ltime2 = { 0 };
localtime_r(&ltime, &ltime2);
char* str = asctime(&ltime2);
#endif
printf("%.*s", (int)strlen(str) - 1, str);
}

View File

@ -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(&ltime));
#else
struct tm ltime2 = { 0 };
localtime_r(&ltime, &ltime2);
char* str = asctime(&ltime2);
#endif
fprintf(f, "%.*s", (int)strlen(str) - 1, str);
}