]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/icl/test/chrono/utility.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / icl / test / chrono / utility.hpp
1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2011-2011: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENCE.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef BOOST_LIBS_ICL_TEST_CHRONO_UTILITY_HPP_JOFA_20110314
9 #define BOOST_LIBS_ICL_TEST_CHRONO_UTILITY_HPP_JOFA_20110314
10
11 #include <boost/chrono/chrono.hpp>
12 #include <boost/chrono/chrono_io.hpp>
13
14 // In order to perform simple testing with chrono::time_point
15 // we need to provide a dummy test clock
16
17 class Now // A trivial test clock
18 {
19 public:
20 typedef boost::chrono::duration<int> duration;
21 typedef duration::rep rep;
22 typedef duration::period periond;
23 typedef boost::chrono::time_point<Now> time_point;
24
25 static time_point now(){ return time_point(); }
26 };
27
28 namespace boost{ namespace chrono {
29
30 template <class CharT>
31 struct clock_string<Now, CharT>
32 {
33 static std::basic_string<CharT> name()
34 {
35 static const CharT u[] = {'n', 'o', 'w', '_', 'c', 'l','o', 'c', 'k'};
36 static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
37 return str;
38 }
39 static std::basic_string<CharT> since()
40 {
41 const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'n', 'o', 'w'};
42 const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
43 return str;
44 }
45 };
46
47 }} //namespace boost chrono
48
49 #endif //BOOST_LIBS_ICL_TEST_CHRONO_UTILITY_HPP_JOFA_20110314