From e8c188e9f493c760dc42d6bd121bb8626a1b99eb Mon Sep 17 00:00:00 2001 From: Cvolton Date: Thu, 24 Aug 2023 15:37:20 +0200 Subject: [PATCH] use strftime to build dates --- src/utils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index a6540ae..5eeaa92 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -234,9 +235,9 @@ std::string BetterInfo::fixNullByteCrash(std::string input) { } std::string BetterInfo::timeToString(time_t input) { - struct tm time3; - localtime_s(&time3, &input); - return fmt::format("{}-{:02}-{:02} {:02}:{:02}", time3.tm_year + 1900, time3.tm_mon + 1, time3.tm_mday, time3.tm_hour, time3.tm_min); + char dateString[255]; + strftime(dateString, sizeof(dateString), "%F %H:%M", localtime(&input)); + return dateString; } void BetterInfo::copyToClipboard(const char* text){