From a45c939040b7943ab2bd952889953f8cda6e460f 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 d19e591f..54ab3d3b 100644 --- a/include/spdlog/stopwatch.h +++ b/include/spdlog/stopwatch.h @@ -39,6 +39,10 @@ public: 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