Skip to content

Commit

Permalink
fix pbar clock type
Browse files Browse the repository at this point in the history
  • Loading branch information
samayala22 committed Sep 19, 2024
1 parent 03d7e4e commit 6710115
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions headeronly/tinypbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class pbar {
bool disable = false, double rate = 60.0)
: start_(start), end_(end), step_(step), disable(disable), rate(rate),
i(start-step), n(0), skip(1ull), desc_(desc) {
start_time = std::chrono::high_resolution_clock::now();
start_time = std::chrono::steady_clock::now();
total = (end_ - start_ + step_ - 1) / step_;
update(0);
}
Expand All @@ -90,7 +90,7 @@ class pbar {

if (disable || (!close && static_cast<int>(i - start_) % skip != 0)) return;

auto now = std::chrono::high_resolution_clock::now();
auto now = std::chrono::steady_clock::now();
double elapsed = std::chrono::duration<double>(now - start_time).count(); // cast to seconds
elapsed += 1e-6; // add 1 microsecond to avoid rounding errors
double progress = static_cast<double>(n) / total;
Expand Down

0 comments on commit 6710115

Please sign in to comment.