From 7b9a4850d67df59c4dc9aea7401b5b89642a9349 Mon Sep 17 00:00:00 2001 From: Alan Candido Date: Sat, 9 Mar 2024 11:25:56 -0300 Subject: [PATCH] Update stopwatch.h 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 d19e591f7..54ab3d3b8 100644 --- a/include/spdlog/stopwatch.h +++ b/include/spdlog/stopwatch.h @@ -39,6 +39,10 @@ class stopwatch { 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