Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:48

0001 //  boost/chrono/round.hpp  ------------------------------------------------------------//
0002 
0003 //  (C) Copyright Howard Hinnant
0004 //  Copyright 2011 Vicente J. Botet Escriba
0005 
0006 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0007 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/libs/chrono for documentation.
0010 
0011 #ifndef BOOST_CHRONO_FLOOR_HPP
0012 #define BOOST_CHRONO_FLOOR_HPP
0013 
0014 #include <boost/chrono/duration.hpp>
0015 
0016 namespace boost
0017 {
0018   namespace chrono
0019   {
0020 
0021     /**
0022      * rounds down
0023      */
0024     template <class To, class Rep, class Period>
0025     To floor(const duration<Rep, Period>& d)
0026     {
0027       To t = duration_cast<To>(d);
0028       if (t>d) --t;
0029       return t;
0030     }
0031 
0032 
0033   } // namespace chrono
0034 } // namespace boost
0035 
0036 #endif