From 5a207ad9cea4e0f8910f1c1f09757834e4a8ea8e Mon Sep 17 00:00:00 2001 From: Alan Candido Date: Sat, 9 Mar 2024 16:40:05 -0300 Subject: [PATCH] Update stopwatch.h (#3034) Adding elapsed time in milliseconds. --- include/spdlog/stopwatch.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/spdlog/stopwatch.h b/include/spdlog/stopwatch.h index 115f56705..4a383eb44 100644 --- a/include/spdlog/stopwatch.h +++ b/include/spdlog/stopwatch.h @@ -38,6 +38,10 @@ class stopwatch { std::chrono::duration elapsed() const { return std::chrono::duration(clock::now() - start_tp_); } + std::chrono::milliseconds elapsed_ms() const { + return std::chrono::duration_cast(clock::now() - start_tp_); + } + void reset() { start_tp_ = clock::now(); } }; } // namespace spdlog