Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:48

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 // Adapted from donated nonius code.
0009 
0010 #ifndef CATCH_CLOCK_HPP_INCLUDED
0011 #define CATCH_CLOCK_HPP_INCLUDED
0012 
0013 #include <chrono>
0014 #include <ratio>
0015 
0016 namespace Catch {
0017     namespace Benchmark {
0018         template <typename Clock>
0019         using ClockDuration = typename Clock::duration;
0020         template <typename Clock>
0021         using FloatDuration = std::chrono::duration<double, typename Clock::period>;
0022 
0023         template <typename Clock>
0024         using TimePoint = typename Clock::time_point;
0025 
0026         using default_clock = std::chrono::steady_clock;
0027 
0028         template <typename Clock>
0029         struct now {
0030             TimePoint<Clock> operator()() const {
0031                 return Clock::now();
0032             }
0033         };
0034 
0035         using fp_seconds = std::chrono::duration<double, std::ratio<1>>;
0036     } // namespace Benchmark
0037 } // namespace Catch
0038 
0039 #endif // CATCH_CLOCK_HPP_INCLUDED