Skip to content

Commit

Permalink
use strftime to build dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Aug 24, 2023
1 parent 4ad5a8e commit e8c188e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <random>
#include <fmt/format.h>
#include <time.h>

#include <Geode/cocos/support/base64.h>
#include <Geode/cocos/support/zip_support/ZipUtils.h>
Expand Down Expand Up @@ -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){
Expand Down

0 comments on commit e8c188e

Please sign in to comment.