diff options
author | Jonas Häggqvist <rasher@rasher.dk> | 2007-08-21 22:54:57 +0000 |
---|---|---|
committer | Jonas Häggqvist <rasher@rasher.dk> | 2007-08-21 22:54:57 +0000 |
commit | 496206be6e71169bcbb6516c435c604c5ae91948 (patch) | |
tree | 1f7ab9128bc2bb2511e36ed259fd977aad02be26 /apps/menus | |
parent | 167564b1431d61ebd629835796f31471ec3b6b58 (diff) |
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
Diffstat (limited to 'apps/menus')
-rw-r--r-- | apps/menus/main_menu.c | 49 |
1 files changed, 46 insertions, 3 deletions
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); |