From 496206be6e71169bcbb6516c435c604c5ae91948 Mon Sep 17 00:00:00 2001 From: Jonas Häggqvist Date: Tue, 21 Aug 2007 22:54:57 +0000 Subject: Voice the time in the format the user selects in the time format setting. Patch FS#7561 by Daniel Dalton. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14418 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ apps/menus/main_menu.c | 49 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 9c656fba69..29e2d1df79 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11054,3 +11054,54 @@ *: "units per tick" + + id: VOICE_OCLOCK + desc: spoken only, for wall clock announce + user: + + *: none + rtc: "" + + + *: none + rtc: "" + + + *: none + rtc: "o'clock" + + + + id: VOICE_PM + desc: spoken only, for wall clock announce + user: + + *: none + rtc: "" + + + *: none + rtc: "" + + + *: none + rtc: "P M" + + + + id: VOICE_AM + desc: spoken only, for wall clock announce + user: + + *: none + rtc: "" + + + *: none + rtc: "" + + + *: none + rtc: "A M" + + diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 1ae5774d15..6c828ce1be 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -209,9 +209,52 @@ static bool show_info(void) { struct tm* tm = get_time(); talk_id(VOICE_CURRENT_TIME, true); - talk_value(tm->tm_hour, UNIT_HOUR, true); - talk_value(tm->tm_min, UNIT_MIN, true); - talk_value(tm->tm_sec, UNIT_SEC, true); + if (global_settings.timeformat == 1) + { + /* Voice the time in 12 hour format */ + if (tm->tm_hour == 0) + { + /* Make it say 12 am instead of 0 am */ + talk_value(12, UNIT_INT, true); + } + else if (tm->tm_hour <= 12) + { + /* If between 0 and 12, we voice the hour as-is */ + talk_value(tm->tm_hour, UNIT_INT, true); + } + else + { + /* Subtract 12 hours if we're past noon */ + talk_value(tm->tm_hour-12, UNIT_INT, true); + } + + /* Voice the minutes */ + if (tm->tm_min == 0) + { + /*say o'clock if the minute is 0. */ + talk_id(VOICE_OCLOCK, true); + } + else + { + talk_value(tm->tm_min, UNIT_INT, true); + } + + /* Voice the suffix */ + if (tm->tm_hour >= 12) + { + talk_id(VOICE_PM, true); + } + else + { + talk_id(VOICE_AM, true); + } + } + else + { + /*voice the time in 24 hour format*/ + talk_value(tm->tm_hour, UNIT_HOUR, true); + talk_value(tm->tm_min, UNIT_MIN, true); + } talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); talk_number(tm->tm_mday, true); talk_number(1900 + tm->tm_year, true); -- cgit v1.2.3