1 // boost/chrono/round.hpp ------------------------------------------------------------// 2 3 // (C) Copyright Howard Hinnant 4 // Copyright 2011 Vicente J. Botet Escriba 5 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) 8 9 // See http://www.boost.org/libs/chrono for documentation. 10 11 #ifndef BOOST_CHRONO_CEIL_HPP 12 #define BOOST_CHRONO_CEIL_HPP 13 14 #include <boost/chrono/duration.hpp> 15 16 namespace boost 17 { 18 namespace chrono 19 { 20 21 /** 22 * rounds up 23 */ 24 template <class To, class Rep, class Period> ceil(const duration<Rep,Period> & d)25 To ceil(const duration<Rep, Period>& d) 26 { 27 To t = duration_cast<To>(d); 28 if (t < d) 29 ++t; 30 return t; 31 } 32 33 } // namespace chrono 34 } // namespace boost 35 36 #endif 37