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
This commit is contained in:
Jonas Häggqvist 2007-08-21 22:54:57 +00:00
parent 167564b143
commit 496206be6e
3 changed files with 98 additions and 3 deletions

View file

@ -11054,3 +11054,54 @@
*: "units per tick" *: "units per tick"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: VOICE_OCLOCK
desc: spoken only, for wall clock announce
user:
<source>
*: none
rtc: ""
</source>
<dest>
*: none
rtc: ""
</dest>
<voice>
*: none
rtc: "o'clock"
</voice>
</phrase>
<phrase>
id: VOICE_PM
desc: spoken only, for wall clock announce
user:
<source>
*: none
rtc: ""
</source>
<dest>
*: none
rtc: ""
</dest>
<voice>
*: none
rtc: "P M"
</voice>
</phrase>
<phrase>
id: VOICE_AM
desc: spoken only, for wall clock announce
user:
<source>
*: none
rtc: ""
</source>
<dest>
*: none
rtc: ""
</dest>
<voice>
*: none
rtc: "A M"
</voice>
</phrase>

View file

@ -209,9 +209,52 @@ static bool show_info(void)
{ {
struct tm* tm = get_time(); struct tm* tm = get_time();
talk_id(VOICE_CURRENT_TIME, true); talk_id(VOICE_CURRENT_TIME, 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_hour, UNIT_HOUR, true);
talk_value(tm->tm_min, UNIT_MIN, true); talk_value(tm->tm_min, UNIT_MIN, true);
talk_value(tm->tm_sec, UNIT_SEC, true); }
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
talk_number(tm->tm_mday, true); talk_number(tm->tm_mday, true);
talk_number(1900 + tm->tm_year, true); talk_number(1900 + tm->tm_year, true);

View file

@ -317,6 +317,7 @@ Lenny Koepsell
Harry Tu Harry Tu
Pawel Wysocki Pawel Wysocki
Xinlu Huang Xinlu Huang
Daniel Dalton
The libmad team The libmad team
The wavpack team The wavpack team
The ffmpeg team The ffmpeg team