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

@@ -42,7 +42,7 @@
#include "rail.h"
#include "game/game.hpp"
#include "table/strings.h"
#include "walltime_func.h"
#include "3rdparty/fmt/chrono.h"
#include "company_cmd.h"
#include "misc_cmd.h"
@@ -1460,9 +1460,7 @@ DEF_CONSOLE_CMD(ConGetSysDate)
return true;
}
char buffer[lengthof("2000-01-02 03:04:05")];
LocalTime::Format(buffer, lastof(buffer), "%Y-%m-%d %H:%M:%S");
IConsolePrint(CC_DEFAULT, "System Date: {}", buffer);
IConsolePrint(CC_DEFAULT, "System Date: {:%Y-%m-%d %H:%M:%S}", fmt::localtime(time(nullptr)));
return true;
}