diff --git a/src/shared/log.c b/src/shared/log.c index 0479812..bc8ffed 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -14,7 +14,8 @@ void log_message(LogLevel log_level, const char* format, ...) { if (log_level < current_log_level) return; time_t now = time(NULL); - const struct tm* t = localtime(&now); + struct tm result_buf; + const struct tm* t = localtime_r(&now, &result_buf); fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, log_level_strings[log_level]);