catch_timer.hpp
1 2 // Copyright Catch2 Authors 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE.txt or copy at 5 // https://www.boost.org/LICENSE_1_0.txt) 6 7 // SPDX-License-Identifier: BSL-1.0 8 #ifndef CATCH_TIMER_HPP_INCLUDED 9 #define CATCH_TIMER_HPP_INCLUDED 10 11 #include <cstdint> 12 13 namespace Catch { 14 15 class Timer { 16 uint64_t m_nanoseconds = 0; 17 public: 18 void start(); 19 auto getElapsedNanoseconds() const -> uint64_t; 20 auto getElapsedMicroseconds() const -> uint64_t; 21 auto getElapsedMilliseconds() const -> unsigned int; 22 auto getElapsedSeconds() const -> double; 23 }; 24 25 } // namespace Catch 26 27 #endif // CATCH_TIMER_HPP_INCLUDED