Codechange: use fmt::format and time conversions over "custom" implementation

This commit is contained in:
Rubidium
2023-05-20 16:14:12 +02:00
committed by rubidium42
parent eb635b85bb
commit a19a43a4f7
7 changed files with 13 additions and 105 deletions

View File

@@ -12,7 +12,7 @@
#include "string_func.h"
#include "console_func.h"
#include "spritecache.h"
#include "walltime_func.h"
#include "3rdparty/fmt/chrono.h"
#include "timer/timer.h"
#include "timer/timer_game_tick.h"
@@ -131,13 +131,7 @@ void NewGRFProfiler::Abort()
*/
std::string NewGRFProfiler::GetOutputFilename() const
{
char timestamp[16] = {};
LocalTime::Format(timestamp, lastof(timestamp), "%Y%m%d-%H%M");
char filepath[MAX_PATH] = {};
seprintf(filepath, lastof(filepath), "%sgrfprofile-%s-%08X.csv", FiosGetScreenshotDir(), timestamp, BSWAP32(this->grffile->grfid));
return std::string(filepath);
return fmt::format("{}grfprofile-{%Y%m%d-%H%M}-{:08X}.csv", FiosGetScreenshotDir(), fmt::localtime(time(nullptr)), BSWAP32(this->grffile->grfid));
}
/* static */ uint32 NewGRFProfiler::FinishAll()