1 // boost/chrono/round.hpp ------------------------------------------------------------//
3 // (C) Copyright Howard Hinnant
4 // Copyright 2011 Vicente J. Botet Escriba
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/chrono for documentation.
11 #ifndef BOOST_CHRONO_ROUND_HPP
12 #define BOOST_CHRONO_ROUND_HPP
14 #include <boost/chrono/duration.hpp>
15 #include <boost/chrono/duration.hpp>
16 //#include <boost/chrono/typeof/boost/chrono/chrono.hpp>
24 * rounds to nearest, to even on tie
26 template <class To, class Rep, class Period>
27 To round(const duration<Rep, Period>& d)
29 typedef typename common_type<To, duration<Rep, Period> >::type result_type;
33 To t0 = duration_cast<To>(d);
51 else if (diff0 < diff1)