1 | // Copyright 2015 Vicente J. Botet Escriba |
---|---|
2 | // Distributed under the Boost Software License, Version 1.0. |
3 | // See http://www.boost.org/LICENSE_1_0.txt |
4 | // See http://www.boost.org/libs/chrono for documentation. |
5 | |
6 | //#define BOOST_CHRONO_VERSION 1 |
7 | #define BOOST_CHRONO_VERSION 2 |
8 | #include <iostream> |
9 | #include <boost/rational.hpp> |
10 | #include <boost/chrono/chrono.hpp> |
11 | //#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 |
12 | #include <boost/chrono/chrono_io.hpp> |
13 | |
14 | int main() |
15 | { |
16 | { |
17 | typedef boost::chrono::duration<float> RationalSeconds; |
18 | RationalSeconds d(0.5); |
19 | std::cout << d << std::endl; |
20 | } |
21 | { |
22 | typedef boost::chrono::duration<boost::rational<int> > RationalSeconds; |
23 | RationalSeconds d; |
24 | std::cout << d << std::endl; |
25 | } |
26 | return 0; |
27 | } |
28 |