convert.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright Oliver Kowalke 2013.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_FIBERS_DETAIL_CONVERT_H
  6. #define BOOST_FIBERS_DETAIL_CONVERT_H
  7. #include <chrono>
  8. #include <memory>
  9. #include <boost/config.hpp>
  10. #include <boost/fiber/detail/config.hpp>
  11. #ifdef BOOST_HAS_ABI_HEADERS
  12. # include BOOST_ABI_PREFIX
  13. #endif
  14. namespace boost {
  15. namespace fibers {
  16. namespace detail {
  17. inline
  18. std::chrono::steady_clock::time_point convert(
  19. std::chrono::steady_clock::time_point const& timeout_time) noexcept {
  20. return timeout_time;
  21. }
  22. template< typename Clock, typename Duration >
  23. std::chrono::steady_clock::time_point convert(
  24. std::chrono::time_point< Clock, Duration > const& timeout_time) {
  25. return std::chrono::steady_clock::now() + ( timeout_time - Clock::now() );
  26. }
  27. }}}
  28. #ifdef BOOST_HAS_ABI_HEADERS
  29. # include BOOST_ABI_SUFFIX
  30. #endif
  31. #endif // BOOST_FIBERS_DETAIL_CONVERT_H