]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/chrono/example/clock_name.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / chrono / example / clock_name.hpp
1 // stopclock_perf.cpp ---------------------------------------------------//
2
3 // Copyright 2009 Vicente J. Botet Escriba
4 // Copyright 2009 Howard Hinnant
5
6 // Distributed under the Boost Software License, Version 1.0.
7 // See http://www.boost.org/LICENSE_1_0.txt
8
9 // See http://www.boost.org/libs/chrono for documentation.
10
11 #ifndef BOOST_CHRONO_CLOCK_NAME_HPP
12 #define BOOST_CHRONO_CLOCK_NAME_HPP
13
14 #include <boost/chrono/chrono.hpp>
15 #include <boost/type_traits/is_same.hpp>
16
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,
21 #else
22 bool = false,
23 #endif
24 bool = boost::is_same<Clock, boost::chrono::high_resolution_clock>::value
25 >
26 struct name;
27
28 template <typename Clock>
29 struct name<Clock, false, false, false> {
30 static const char* apply() { return "unknown clock";}
31 };
32
33 template <typename Clock>
34 struct name<Clock, true, false, false> {
35 static const char* apply() { return "system_clock";}
36 };
37
38 template <typename Clock>
39 struct name<Clock, false, true, false> {
40 static const char* apply() { return "steady_clock";}
41 };
42
43 template <typename Clock>
44 struct name<Clock, false, false, true> {
45 static const char* apply() { return "high_resolution_clock";}
46 };
47
48 template <typename Clock>
49 struct name<Clock, false, true, true> {
50 static const char* apply() { return "steady_clock and high_resolution_clock";}
51 };
52
53 template <typename Clock>
54 struct name<Clock, true, false, true> {
55 static const char* apply() { return "system_clock and high_resolution_clock";}
56 };
57
58 template <typename Clock>
59 struct name<Clock, true, true, false> {
60 static const char* apply() { return "system_clock and steady_clock";}
61 };
62
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";}
66 };
67
68 #endif