summaryrefslogtreecommitdiff
path: root/apps/talk.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/talk.c')
-rw-r--r--apps/talk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 8c0f1f3a07..5fddf85986 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -1015,7 +1015,7 @@ int talk_number(long n, bool enqueue)
1015 1015
1016/* Say time duration/interval. Input is time in seconds, 1016/* Say time duration/interval. Input is time in seconds,
1017 say hours,minutes,seconds. */ 1017 say hours,minutes,seconds. */
1018static int talk_time_unit(long secs, bool enqueue) 1018static int talk_time_unit(long secs, bool exact, bool enqueue)
1019{ 1019{
1020 int hours, mins; 1020 int hours, mins;
1021 if (!enqueue) 1021 if (!enqueue)
@@ -1026,9 +1026,11 @@ static int talk_time_unit(long secs, bool enqueue)
1026 } 1026 }
1027 if((mins = secs/60)) { 1027 if((mins = secs/60)) {
1028 secs %= 60; 1028 secs %= 60;
1029 talk_value(mins, UNIT_MIN, true); 1029 if(exact || !hours)
1030 talk_value(mins, UNIT_MIN, true);
1031 else talk_number(mins, true); /* don't say "minutes" */
1030 } 1032 }
1031 if((secs) || (!hours && !mins)) 1033 if((exact && secs) || (!hours && !mins))
1032 talk_value(secs, UNIT_SEC, true); 1034 talk_value(secs, UNIT_SEC, true);
1033 else if(!hours && secs) 1035 else if(!hours && secs)
1034 talk_number(secs, true); 1036 talk_number(secs, true);
@@ -1108,8 +1110,8 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue)
1108#endif 1110#endif
1109 1111
1110 /* special case for time duration */ 1112 /* special case for time duration */
1111 if (unit == UNIT_TIME) 1113 if (unit == UNIT_TIME || unit == UNIT_TIME_EXACT)
1112 return talk_time_unit(n, enqueue); 1114 return talk_time_unit(n, unit == UNIT_TIME_EXACT, enqueue);
1113 1115
1114 if (unit < 0 || unit >= UNIT_LAST) 1116 if (unit < 0 || unit >= UNIT_LAST)
1115 unit_id = -1; 1117 unit_id = -1;