1
0
Fork 0
forked from len0rd/rockbox

Save a few bytes by changing unit selection strategy

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15283 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2007-10-24 10:29:45 +00:00
parent 56ddddc274
commit 537b27d58f

View file

@ -819,8 +819,8 @@ const int monthname[] = {
/* little helper function for voice output */ /* little helper function for voice output */
static void say_time(int cursorpos, const struct tm *tm) static void say_time(int cursorpos, const struct tm *tm)
{ {
static const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 };
int value = 0; int value = 0;
int unit = 0;
if (!global_settings.talk_menu) if (!global_settings.talk_menu)
return; return;
@ -829,12 +829,15 @@ static void say_time(int cursorpos, const struct tm *tm)
{ {
case 0: case 0:
value = tm->tm_hour; value = tm->tm_hour;
unit = UNIT_HOUR;
break; break;
case 1: case 1:
value = tm->tm_min; value = tm->tm_min;
unit = UNIT_MIN;
break; break;
case 2: case 2:
value = tm->tm_sec; value = tm->tm_sec;
unit = UNIT_SEC;
break; break;
case 3: case 3:
value = tm->tm_year + 1900; value = tm->tm_year + 1900;
@ -847,7 +850,7 @@ static void say_time(int cursorpos, const struct tm *tm)
if (cursorpos == 4) /* month */ if (cursorpos == 4) /* month */
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false); talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false);
else else
talk_value(value, unit[cursorpos], false); talk_value(value, unit, false);
} }