1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix date display for non-American locales on *nix (#10949)

This commit is contained in:
Michael Steenbeek
2020-03-20 00:10:15 +01:00
committed by GitHub
parent 99b7cfbd7a
commit ba8a4e6183

View File

@@ -13,6 +13,7 @@
# include "Platform2.h"
# include "platform.h"
# include <clocale>
# include <cstdlib>
# include <cstring>
# include <ctime>
@@ -72,6 +73,7 @@ namespace Platform
std::string FormatShortDate(std::time_t timestamp)
{
setlocale(LC_TIME, "");
char date[20];
std::strftime(date, sizeof(date), "%x", std::localtime(&timestamp));
return std::string(date);
@@ -79,6 +81,7 @@ namespace Platform
std::string FormatTime(std::time_t timestamp)
{
setlocale(LC_TIME, "");
char time[20];
std::strftime(time, sizeof(time), "%X", std::localtime(&timestamp));
return std::string(time);