1 // stopclock_perf.cpp ---------------------------------------------------//
3 // Copyright 2009 Vicente J. Botet Escriba
4 // Copyright 2009 Howard Hinnant
6 // Distributed under the Boost Software License, Version 1.0.
7 // See http://www.boost.org/LICENSE_1_0.txt
9 // See http://www.boost.org/libs/chrono for documentation.
11 #ifndef BOOST_CHRONO_CLOCK_NAME_HPP
12 #define BOOST_CHRONO_CLOCK_NAME_HPP
14 #include <boost/chrono/chrono.hpp>
15 #include <boost/type_traits/is_same.hpp>
17 template <typename Clock,
18 bool = boost::is_same<Clock, boost::chrono::system_clock>::value,
19 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
20 bool = boost::is_same<Clock, boost::chrono::steady_clock>::value,
24 bool = boost::is_same<Clock, boost::chrono::high_resolution_clock>::value
28 template <typename Clock>
29 struct name<Clock, false, false, false> {
30 static const char* apply() { return "unknown clock";}
33 template <typename Clock>
34 struct name<Clock, true, false, false> {
35 static const char* apply() { return "system_clock";}
38 template <typename Clock>
39 struct name<Clock, false, true, false> {
40 static const char* apply() { return "steady_clock";}
43 template <typename Clock>
44 struct name<Clock, false, false, true> {
45 static const char* apply() { return "high_resolution_clock";}
48 template <typename Clock>
49 struct name<Clock, false, true, true> {
50 static const char* apply() { return "steady_clock and high_resolution_clock";}
53 template <typename Clock>
54 struct name<Clock, true, false, true> {
55 static const char* apply() { return "system_clock and high_resolution_clock";}
58 template <typename Clock>
59 struct name<Clock, true, true, false> {
60 static const char* apply() { return "system_clock and steady_clock";}
63 template <typename Clock>
64 struct name<Clock, true, true, true> {
65 static const char* apply() { return "system_clock, steady_clock and high_resolution_clock";}