From 1e5a3959a4608fa69ca3c31e27ba8feb6a379ddd Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Fri, 24 Nov 2023 00:04:45 +0200 Subject: [PATCH] Partially revert 3d9854b and tweak a bit I just found out that localtime_r() is a newer addition to the posix standard, I missed that when I was reading the docs. Not sure why my C99 config didn't throw any warnings about that, but reverting back to good ol' localtime() --- src/utils/logging.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utils/logging.c b/src/utils/logging.c index 2f4879b1..3a34f8d7 100644 --- a/src/utils/logging.c +++ b/src/utils/logging.c @@ -54,15 +54,14 @@ static void printPrefix(enum logType type) { static void printDate() { const time_t curTime = time(NULL); - struct tm time = { 0 }; - localtime_r(&curTime, &time); + struct tm *time = localtime(&curTime); printf("[%d-%02d-%02d %02d:%02d:%02d] ", - time.tm_year + 1900, - time.tm_mon + 1, - time.tm_mday, - time.tm_hour, - time.tm_min, - time.tm_sec); + time->tm_year + 1900, + time->tm_mon + 1, + time->tm_mday, + time->tm_hour, + time->tm_min, + time->tm_sec); } void log_toggle_verbose(void) {