33 double percentage =
static_cast<double>(progress) / total;
34 int filledWidth =
static_cast<int>(barWidth * percentage);
38 for (
int i = 0; i < filledWidth; ++i) {
41 for (
int i = filledWidth; i < barWidth; ++i) {
44 strm <<
"] " <<
static_cast<int>(percentage * 100.0) <<
"%";
48 auto currentTime = std::chrono::high_resolution_clock::now();
49 auto elapsedTime = std::chrono::duration_cast<std::chrono::seconds>(currentTime - startTime).count();
53 if( progress == total){
54 minutes =
static_cast<int>(elapsedTime / 60);
55 seconds =
static_cast<int>(elapsedTime) % 60;
57 double estimatedTotalTime = (elapsedTime / percentage);
58 double etaSeconds = estimatedTotalTime - elapsedTime;
60 minutes =
static_cast<int>(etaSeconds / 60);
61 seconds =
static_cast<int>(etaSeconds) % 60;
63 strm <<
" ETA: " << minutes <<
"m " << seconds <<
"s ";