summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/talk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/talk.c b/apps/talk.c
index e9d54fd..0635e50 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -826,6 +826,7 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue)
};
char tbuf[8];
+ char fmt[] = "%0nd";
if (talk_temp_disable_count > 0)
return -1; /* talking has been disabled */
@@ -865,7 +866,9 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue)
n = -n;
}
- snprintf(tbuf, sizeof(tbuf), "%0*d", decimals, n % pow10[decimals]);
+ fmt[2] = '0' + decimals;
+
+ snprintf(tbuf, sizeof(tbuf), fmt, n % pow10[decimals]);
talk_fractional(tbuf, n / pow10[decimals], unit_id);
return 0;