1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00

Implement platform_get_locale_date_format for Linux

Note that this currently, this isn't implemented in the C++ standard
library. This means that date_order() will always return no_order,
causing this function to always return the default
DATE_FORMAT_DAY_MONTH_YEAR, as is the case before this commit too.

Once date_order() will be properly implemented in the standard library
someday, it will however start returning the right order for the current
locale, causing this function to start working as intended.
This commit is contained in:
Sijmen Schoon
2018-08-12 23:03:32 +02:00
committed by Michael Steenbeek
parent a1072a2380
commit 56b174432d
2 changed files with 18 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
- Feature: [#7868] Placing scenery while holding shift now scales appropriately with zoom levels.
- Fix: [#3177] Wrong keys displayed in shortcut menu.
- Fix: [#4039] No sprite font glyph for German opening quotation mark.
- Fix: [#5548] platform_get_locale_date_format is not implemented for Linux.
- Fix: [#7204] Object source filters do not work for RCT1, AA and LL.
- Fix: [#7440] Memory leak. All system memory used.
- Fix: [#7462] Guest window goes beyond the map edge on a spiral slide.

View File

@@ -27,6 +27,7 @@
# include <libgen.h>
# include <locale.h>
# include <locale>
# include <pwd.h>
# include <stdlib.h>
# include <sys/file.h>
@@ -421,7 +422,22 @@ uint8_t platform_get_locale_temperature_format()
uint8_t platform_get_locale_date_format()
{
return DATE_FORMAT_DAY_MONTH_YEAR;
const std::time_base::dateorder dateorder = std::use_facet<std::time_get<char>>(std::locale()).date_order();
switch (dateorder)
{
case std::time_base::mdy:
return DATE_FORMAT_MONTH_DAY_YEAR;
case std::time_base::ymd:
return DATE_FORMAT_YEAR_MONTH_DAY;
case std::time_base::ydm:
return DATE_FORMAT_YEAR_DAY_MONTH;
default:
return DATE_FORMAT_DAY_MONTH_YEAR;
}
}
datetime64 platform_get_datetime_now_utc()