Skip to content

Commit

Permalink
Update stopwatch.h (#3034)
Browse files Browse the repository at this point in the history
Adding elapsed time in milliseconds.
  • Loading branch information
brodao2 authored and gabime committed Mar 16, 2024
1 parent 87b8401 commit 5a207ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/spdlog/stopwatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class stopwatch {

std::chrono::duration<double> elapsed() const { return std::chrono::duration<double>(clock::now() - start_tp_); }

std::chrono::milliseconds elapsed_ms() const {
return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() - start_tp_);
}

void reset() { start_tp_ = clock::now(); }
};
} // namespace spdlog
Expand Down

0 comments on commit 5a207ad

Please sign in to comment.