summaryrefslogtreecommitdiff
path: root/apps/menus
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2007-08-21 22:54:57 +0000
committerJonas Häggqvist <rasher@rasher.dk>2007-08-21 22:54:57 +0000
commit496206be6e71169bcbb6516c435c604c5ae91948 (patch)
tree1f7ab9128bc2bb2511e36ed259fd977aad02be26 /apps/menus
parent167564b1431d61ebd629835796f31471ec3b6b58 (diff)
downloadrockbox-496206be6e71169bcbb6516c435c604c5ae91948.tar.gz
rockbox-496206be6e71169bcbb6516c435c604c5ae91948.zip
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.c49
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)
209 { 209 {
210 struct tm* tm = get_time(); 210 struct tm* tm = get_time();
211 talk_id(VOICE_CURRENT_TIME, true); 211 talk_id(VOICE_CURRENT_TIME, true);
212 talk_value(tm->tm_hour, UNIT_HOUR, true); 212 if (global_settings.timeformat == 1)
213 talk_value(tm->tm_min, UNIT_MIN, true); 213 {
214 talk_value(tm->tm_sec, UNIT_SEC, true); 214 /* Voice the time in 12 hour format */
215 if (tm->tm_hour == 0)
216 {
217 /* Make it say 12 am instead of 0 am */
218 talk_value(12, UNIT_INT, true);
219 }
220 else if (tm->tm_hour <= 12)
221 {
222 /* If between 0 and 12, we voice the hour as-is */
223 talk_value(tm->tm_hour, UNIT_INT, true);
224 }
225 else
226 {
227 /* Subtract 12 hours if we're past noon */
228 talk_value(tm->tm_hour-12, UNIT_INT, true);
229 }
230
231 /* Voice the minutes */
232 if (tm->tm_min == 0)
233 {
234 /*say o'clock if the minute is 0. */
235 talk_id(VOICE_OCLOCK, true);
236 }
237 else
238 {
239 talk_value(tm->tm_min, UNIT_INT, true);
240 }
241
242 /* Voice the suffix */
243 if (tm->tm_hour >= 12)
244 {
245 talk_id(VOICE_PM, true);
246 }
247 else
248 {
249 talk_id(VOICE_AM, true);
250 }
251 }
252 else
253 {
254 /*voice the time in 24 hour format*/
255 talk_value(tm->tm_hour, UNIT_HOUR, true);
256 talk_value(tm->tm_min, UNIT_MIN, true);
257 }
215 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); 258 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
216 talk_number(tm->tm_mday, true); 259 talk_number(tm->tm_mday, true);
217 talk_number(1900 + tm->tm_year, true); 260 talk_number(1900 + tm->tm_year, true);