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:
committed by
GitHub
parent
99b7cfbd7a
commit
ba8a4e6183
@@ -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(×tamp));
|
||||
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(×tamp));
|
||||
return std::string(time);
|
||||
|
||||
Reference in New Issue
Block a user