progressBar: limit resolution

This commit is contained in:
Gwenhael Goavec-Merou 2021-07-11 11:30:02 +02:00
parent 6a1f67bc69
commit f19d0996a4
1 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,9 @@ void ProgressBar::display(int value, char force)
fputc('=', stderr);
}
fprintf(stderr, "%*s", (int)(_progressLen-nbEq), "");
printInfo("] " + std::to_string(percent) + "%", false);
char perc_str[11];
snprintf(perc_str, sizeof(perc_str), "] %3.2f%%", percent);
printInfo(perc_str, false);
}
void ProgressBar::done()
{