]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/detail/duration.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / detail / duration.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_DETAIL_DURATION_HPP
12 #define BOOST_COMPUTE_DETAIL_DURATION_HPP
13
14 #include <boost/config.hpp>
15
16 #ifndef BOOST_COMPUTE_NO_HDR_CHRONO
17 #include <chrono>
18 #endif
19
20 #include <boost/chrono/duration.hpp>
21
22 namespace boost {
23 namespace compute {
24 namespace detail {
25
26 #ifndef BOOST_COMPUTE_NO_HDR_CHRONO
27 template<class Rep, class Period>
28 inline std::chrono::duration<Rep, Period>
29 make_duration_from_nanoseconds(std::chrono::duration<Rep, Period>, size_t nanoseconds)
30 {
31 return std::chrono::duration_cast<std::chrono::duration<Rep, Period> >(
32 std::chrono::nanoseconds(nanoseconds)
33 );
34 }
35 #endif // BOOST_COMPUTE_NO_HDR_CHRONO
36
37 template<class Rep, class Period>
38 inline boost::chrono::duration<Rep, Period>
39 make_duration_from_nanoseconds(boost::chrono::duration<Rep, Period>, size_t nanoseconds)
40 {
41 return boost::chrono::duration_cast<boost::chrono::duration<Rep, Period> >(
42 boost::chrono::nanoseconds(nanoseconds)
43 );
44 }
45
46 } // end detail namespace
47 } // end compute namespace
48 } // end boost namespace
49
50 #endif // BOOST_COMPUTE_DETAIL_DURATION_HPP