From b3cf7150d5af1d840b500da36114d8326b09843c Mon Sep 17 00:00:00 2001 From: =Christian Murphy Date: Sun, 30 Sep 2018 18:01:43 +0100 Subject: [PATCH 1/4] Date Time setting for AM:PM as an option --- config.def.h | 2 ++ configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.c | 4 +++ intl/msg_hash_us.h | 32 +++++++++++++++++++++ menu/cbs/menu_cbs_sublabel.c | 4 +++ menu/drivers/xmb.c | 2 +- menu/menu_displaylist.c | 3 ++ menu/menu_driver.c | 8 ++++++ menu/menu_setting.c | 56 ++++++++++++++++++++++++++++++++++++ msg_hash.h | 7 +++++ 12 files changed, 121 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 6ba1d7b5ed..5ef2d11626 100644 --- a/config.def.h +++ b/config.def.h @@ -697,6 +697,8 @@ static const unsigned menu_thumbnails_default = 3; static const unsigned menu_left_thumbnails_default = 0; +static const unsigned menu_timedate_style = 3; + static const bool xmb_vertical_thumbnails = false; #ifdef IOS diff --git a/configuration.c b/configuration.c index d8c8018b8d..34890d6407 100644 --- a/configuration.c +++ b/configuration.c @@ -1569,6 +1569,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, #ifdef HAVE_MENU SETTING_UINT("dpi_override_value", &settings->uints.menu_dpi_override_value, true, menu_dpi_override_value, false); SETTING_UINT("menu_thumbnails", &settings->uints.menu_thumbnails, true, menu_thumbnails_default, false); + SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, menu_timedate_style, false); #ifdef HAVE_XMB SETTING_UINT("menu_left_thumbnails", &settings->uints.menu_left_thumbnails, true, menu_left_thumbnails_default, false); SETTING_UINT("xmb_alpha_factor", &settings->uints.menu_xmb_alpha_factor, true, xmb_alpha_factor, false); diff --git a/configuration.h b/configuration.h index e9aeedf17d..6c54982aa8 100644 --- a/configuration.h +++ b/configuration.h @@ -393,6 +393,7 @@ typedef struct settings unsigned video_record_scale_factor; unsigned video_stream_scale_factor; + unsigned menu_timedate_style; unsigned menu_thumbnails; unsigned menu_left_thumbnails; unsigned menu_dpi_override_value; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index f5eaf894e0..51e5707304 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1101,6 +1101,8 @@ MSG_HASH(MENU_ENUM_LABEL_THUMBNAILS_UPDATER_LIST, "thumbnails_updater_list") MSG_HASH(MENU_ENUM_LABEL_TIMEDATE_ENABLE, "menu_timedate_enable") +MSG_HASH(MENU_ENUM_LABEL_TIMEDATE_STYLE, + "menu_timedate_style") MSG_HASH(MENU_ENUM_LABEL_TITLE_COLOR, "menu_title_color") MSG_HASH(MENU_ENUM_LABEL_UI_COMPANION_ENABLE, diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index a3799a3a80..83db0a6a8e 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1738,6 +1738,10 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "Shows current date and/or time inside menu."); break; + case MENU_ENUM_LABEL_TIMEDATE_STYLE: + snprintf(s, len, + "Style to show the current date and/or time in."); + break; case MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE: snprintf(s, len, "Shows current battery level inside menu."); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index a036c7ddf4..d13444ba1a 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2869,6 +2869,38 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, "Show date / time" ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + "Style of date / time" + ) + MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, + "Changes the style current date and/or time is shown inside the menu." + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "YYYY-MM-DD H:M:S" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, + "YY-MM-DD" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "HH:MM:SS" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "DD/MM HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "HH:MM (AM/PM)" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, "Menu title color" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 244d25877e..2c820d863d 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -295,6 +295,7 @@ default_sublabel_macro(action_bind_sublabel_pointer_enable, MENU_ default_sublabel_macro(action_bind_sublabel_thumbnails, MENU_ENUM_SUBLABEL_THUMBNAILS) default_sublabel_macro(action_bind_sublabel_left_thumbnails, MENU_ENUM_SUBLABEL_LEFT_THUMBNAILS) default_sublabel_macro(action_bind_sublabel_timedate_enable, MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE) +default_sublabel_macro(action_bind_sublabel_timedate_style, MENU_ENUM_SUBLABEL_TIMEDATE_STYLE) default_sublabel_macro(action_bind_sublabel_battery_level_enable, MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE) default_sublabel_macro(action_bind_sublabel_navigation_wraparound, MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND) default_sublabel_macro(action_bind_sublabel_audio_resampler_quality, MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY) @@ -1273,6 +1274,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_TIMEDATE_ENABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_timedate_enable); break; + case MENU_ENUM_LABEL_TIMEDATE_STYLE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_timedate_style); + break; case MENU_ENUM_LABEL_THUMBNAILS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_thumbnails); break; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 6977578495..1358337ce1 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3629,7 +3629,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) datetime.s = timedate; datetime.len = sizeof(timedate); - datetime.time_mode = 4; + datetime.time_mode = settings->uints.menu_timedate_style; menu_display_timedate(&datetime); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 5a37ce16be..f32e58d8b9 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5642,6 +5642,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_TIMEDATE_ENABLE, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_TIMEDATE_STYLE, + PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE, PARSE_ONLY_BOOL, false); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 4bae4f41b1..a04091ddde 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -368,6 +368,14 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) strftime(datetime->s, datetime->len, "%d/%m %H:%M", localtime(&time_)); break; + case 5: /* Time (hours-minutes), in 12 hour AM-PM designation */ +#if defined(__linux__) && !defined(ANDROID) + strftime(datetime->s, datetime->len, + "%c", localtime(&time_)); +#else + strftime(datetime->s, datetime->len, + "%I:%M %p", localtime(&time_)); +#endif } } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 0cde556605..14370a1389 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -505,6 +505,47 @@ static void setting_get_string_representation_uint_menu_left_thumbnails( } } +static void setting_get_string_representation_uint_menu_timedate_style( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + switch (*setting->value.target.unsigned_integer) + { + case 0: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS), len); + break; + case 1: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD), len); + break; + case 2: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS), len); + break; + case 3: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM), len); + break; + case 4: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM), len); + break; + case 5: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM), len); + break; + } +} + static void setting_get_string_representation_uint_xmb_icon_theme( rarch_setting_t *setting, char *s, size_t len) @@ -8225,6 +8266,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_ADVANCED); + CONFIG_UINT(list, list_info, + &settings->uints.menu_timedate_style, + MENU_ENUM_LABEL_TIMEDATE_STYLE, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + menu_timedate_style, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_uint_menu_timedate_style; + menu_settings_list_current_add_range(list, list_info, 0, 5, 1, true, true); + CONFIG_BOOL( list, list_info, &settings->bools.menu_battery_level_enable, diff --git a/msg_hash.h b/msg_hash.h index b9095515b2..41ba357eaa 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -832,6 +832,7 @@ enum msg_hash_enums MENU_LABEL(LEFT_THUMBNAILS), MENU_LABEL(XMB_VERTICAL_THUMBNAILS), MENU_LABEL(TIMEDATE_ENABLE), + MENU_LABEL(TIMEDATE_STYLE), MENU_LABEL(BATTERY_LEVEL_ENABLE), MENU_LABEL(MATERIALUI_MENU_COLOR_THEME), MENU_LABEL(QUICK_MENU_OVERRIDE_OPTIONS), @@ -2126,6 +2127,12 @@ enum msg_hash_enums MSG_CHEAT_SEARCH_ADD_MATCH_FAIL, MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, MSG_CHEEVOS_HARDCORE_MODE_DISABLED, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, MSG_LAST }; From 940a03f552e43404323e376485d8c05b8f189172 Mon Sep 17 00:00:00 2001 From: =Christian Murphy Date: Mon, 1 Oct 2018 23:32:54 +0100 Subject: [PATCH 2/4] Linux friendly datetime locale settings, slightly less friendly datetime locale settings for Windows --- config.def.h | 2 +- intl/msg_hash_us.h | 10 +++++++++- menu/drivers/rgui.c | 2 +- menu/menu_driver.c | 26 ++++++++++++++++++-------- menu/menu_setting.c | 23 ++++++++++++++++------- msg_hash.h | 2 ++ 6 files changed, 47 insertions(+), 18 deletions(-) diff --git a/config.def.h b/config.def.h index 5ef2d11626..de7e1dd4fe 100644 --- a/config.def.h +++ b/config.def.h @@ -697,7 +697,7 @@ static const unsigned menu_thumbnails_default = 3; static const unsigned menu_left_thumbnails_default = 0; -static const unsigned menu_timedate_style = 3; +static const unsigned menu_timedate_style = 4; static const bool xmb_vertical_thumbnails = false; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index d13444ba1a..fee3011d21 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2879,7 +2879,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, - "YYYY-MM-DD H:M:S" + "YYYY-MM-DD HH:MM:SS" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "YYYY-MM-DD HH:MM" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, @@ -2897,6 +2901,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, "DD/MM HH:MM" ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "MM/DD HH:MM" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, "HH:MM (AM/PM)" diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index e7d4d982de..346be1ab5d 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -596,7 +596,7 @@ static void rgui_render(void *data, bool is_idle) datetime.s = timedate; datetime.len = sizeof(timedate); - datetime.time_mode = 3; + datetime.time_mode = 4; menu_display_timedate(&datetime); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index a04091ddde..ebdfa229a6 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -17,7 +17,7 @@ #include #include - +#include #include #include #include @@ -346,32 +346,42 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) time(&time_); + setlocale(LC_TIME, ""); + switch (datetime->time_mode) { case 0: /* Date and time */ strftime(datetime->s, datetime->len, "%Y-%m-%d %H:%M:%S", localtime(&time_)); break; - case 1: /* Date */ + case 1: /* YY-MM-DD HH:MM */ strftime(datetime->s, datetime->len, - "%Y-%m-%d", localtime(&time_)); + "%Y-%m-%d %H:%M", localtime(&time_)); break; - case 2: /* Time */ + case 2: /* Date */ + strftime(datetime->s, datetime->len, + "%y-%m-%d", localtime(&time_)); + break; + case 3: /* Time */ strftime(datetime->s, datetime->len, "%H:%M:%S", localtime(&time_)); break; - case 3: /* Time (hours-minutes) */ + case 4: /* Time (hours-minutes) */ strftime(datetime->s, datetime->len, "%H:%M", localtime(&time_)); break; - case 4: /* Date and time, without year and seconds */ + case 5: /* Date and time, without year and seconds */ strftime(datetime->s, datetime->len, "%d/%m %H:%M", localtime(&time_)); break; - case 5: /* Time (hours-minutes), in 12 hour AM-PM designation */ + case 6: + strftime(datetime->s, datetime->len, + "%m/%d %H:%M", localtime(&time_)); + break; + case 7: /* Time (hours-minutes), in 12 hour AM-PM designation */ #if defined(__linux__) && !defined(ANDROID) strftime(datetime->s, datetime->len, - "%c", localtime(&time_)); + "%r", localtime(&time_)); #else strftime(datetime->s, datetime->len, "%I:%M %p", localtime(&time_)); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 14370a1389..853dd69f66 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -519,26 +519,35 @@ static void setting_get_string_representation_uint_menu_timedate_style( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS), len); break; case 1: - strlcpy(s, - msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD), len); + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM), len); break; case 2: strlcpy(s, msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS), len); + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD), len); break; case 3: strlcpy(s, msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM), len); + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS), len); break; case 4: strlcpy(s, msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM), len); + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM), len); break; case 5: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM), len); + break; + case 6: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM), len); + break; + case 7: strlcpy(s, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM), len); @@ -8279,7 +8288,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_menu_timedate_style; - menu_settings_list_current_add_range(list, list_info, 0, 5, 1, true, true); + menu_settings_list_current_add_range(list, list_info, 0, 7, 1, true, true); CONFIG_BOOL( list, list_info, diff --git a/msg_hash.h b/msg_hash.h index 41ba357eaa..0eda40602e 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2128,10 +2128,12 @@ enum msg_hash_enums MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, MSG_CHEEVOS_HARDCORE_MODE_DISABLED, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, MSG_LAST From 017d1b710e6c3864518adbdbba6ddcaf273b4f52 Mon Sep 17 00:00:00 2001 From: =Christian Murphy Date: Fri, 5 Oct 2018 23:11:38 +0100 Subject: [PATCH 3/4] Restore default time mode, replace non-sensical time date formats with more commonly used ones --- config.def.h | 2 +- intl/msg_hash_us.h | 6 +++--- menu/menu_driver.c | 6 +++--- menu/menu_setting.c | 2 +- msg_hash.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.def.h b/config.def.h index de7e1dd4fe..3a73c9044b 100644 --- a/config.def.h +++ b/config.def.h @@ -697,7 +697,7 @@ static const unsigned menu_thumbnails_default = 3; static const unsigned menu_left_thumbnails_default = 0; -static const unsigned menu_timedate_style = 4; +static const unsigned menu_timedate_style = 5; static const bool xmb_vertical_thumbnails = false; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index fee3011d21..8e12aa6fe3 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2886,8 +2886,8 @@ MSG_HASH( "YYYY-MM-DD HH:MM" ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, - "YY-MM-DD" + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, @@ -2907,7 +2907,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, - "HH:MM (AM/PM)" + "HH:MM:SS (AM/PM)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, diff --git a/menu/menu_driver.c b/menu/menu_driver.c index ebdfa229a6..38303dcb68 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -358,9 +358,9 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) strftime(datetime->s, datetime->len, "%Y-%m-%d %H:%M", localtime(&time_)); break; - case 2: /* Date */ + case 2: /* MM-DD-YYYY HH:MM */ strftime(datetime->s, datetime->len, - "%y-%m-%d", localtime(&time_)); + "%m-%d-%Y %H:%M", localtime(&time_)); break; case 3: /* Time */ strftime(datetime->s, datetime->len, @@ -384,7 +384,7 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) "%r", localtime(&time_)); #else strftime(datetime->s, datetime->len, - "%I:%M %p", localtime(&time_)); + "%I:%M:%S %p", localtime(&time_)); #endif } } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 853dd69f66..23812b4e9b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -525,7 +525,7 @@ static void setting_get_string_representation_uint_menu_timedate_style( case 2: strlcpy(s, msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD), len); + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY), len); break; case 3: strlcpy(s, diff --git a/msg_hash.h b/msg_hash.h index 0eda40602e..f35b4502de 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2129,7 +2129,7 @@ enum msg_hash_enums MSG_CHEEVOS_HARDCORE_MODE_DISABLED, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, From 7366a46bc2881048ec20d2a0f6e2bd1bb1884725 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Fri, 5 Oct 2018 19:02:50 -0400 Subject: [PATCH 4/4] convert AM/PM string from local encoding to utf8 --- menu/menu_driver.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 38303dcb68..51d1674395 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef WIIU #include @@ -383,8 +384,20 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) strftime(datetime->s, datetime->len, "%r", localtime(&time_)); #else - strftime(datetime->s, datetime->len, - "%I:%M:%S %p", localtime(&time_)); + { + char *local; + + strftime(datetime->s, datetime->len, + + "%I:%M:%S %p", localtime(&time_)); + local = local_to_utf8_string_alloc(datetime->s); + + if (local) + { + strlcpy(datetime->s, local, datetime->len); + free(local); + } + } #endif } }