9
0
Fork 0

console_countdown: width to of countdown to 4 digits

This patch increases the displayed width of the countdown to 4 digits,
otherwise waiting for more then 99 seconds doesn't look good.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2017-03-10 07:05:21 +01:00 committed by Sascha Hauer
parent dfcfb5b831
commit 3d92ea4738
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
countdown = timeout_s;
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
printf("%2d", countdown--);
printf("%4d", countdown--);
do {
if (tstc()) {
@ -50,7 +50,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
printf("\b\b%2d", countdown--);
printf("\b\b\b\b%4d", countdown--);
second += SECOND;
}
} while (!is_timeout(start, timeout_s * SECOND));