1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_DETAIL_DURATION_HPP
12 #define BOOST_COMPUTE_DETAIL_DURATION_HPP
14 #include <boost/config.hpp>
16 #ifndef BOOST_COMPUTE_NO_HDR_CHRONO
20 #include <boost/chrono/duration.hpp>
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)
31 return std::chrono::duration_cast<std::chrono::duration<Rep, Period> >(
32 std::chrono::nanoseconds(nanoseconds)
35 #endif // BOOST_COMPUTE_NO_HDR_CHRONO
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)
41 return boost::chrono::duration_cast<boost::chrono::duration<Rep, Period> >(
42 boost::chrono::nanoseconds(nanoseconds)
46 } // end detail namespace
47 } // end compute namespace
48 } // end boost namespace
50 #endif // BOOST_COMPUTE_DETAIL_DURATION_HPP