Chris@16: // boost/chrono/round.hpp ------------------------------------------------------------// Chris@16: Chris@16: // (C) Copyright Howard Hinnant Chris@16: // Copyright 2011 Vicente J. Botet Escriba Chris@16: Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org/libs/chrono for documentation. Chris@16: Chris@16: #ifndef BOOST_CHRONO_FLOOR_HPP Chris@16: #define BOOST_CHRONO_FLOOR_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: namespace chrono Chris@16: { Chris@16: Chris@16: /** Chris@16: * rounds down Chris@16: */ Chris@16: template Chris@16: To floor(const duration& d) Chris@16: { Chris@101: To t = duration_cast(d); Chris@101: if (t>d) --t; Chris@101: return t; Chris@16: } Chris@16: Chris@16: Chris@16: } // namespace chrono Chris@16: } // namespace boost Chris@16: Chris@16: #endif