Use floats for remaining time math

This commit is contained in:
Seth Parker
2020-11-16 10:54:05 -05:00
parent c3ff1fbd91
commit e01c2950f2
4 changed files with 14 additions and 10 deletions

View File

@@ -200,7 +200,9 @@ private:
if (saved_start_time) {
auto eta = std::chrono::nanoseconds(
progress_ > 0 ? static_cast<long long>(elapsed.count() * max_progress / progress_) : 0);
progress_ > 0 ? static_cast<long long>(float(elapsed.count()) *
max_progress / progress_)
: 0);
auto remaining = eta > elapsed ? (eta - elapsed) : (elapsed - eta);
details::write_duration(os, remaining);
} else {