test_11012.cpp 761 B

123456789101112131415161718192021222324252627
  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. //#define BOOST_CHRONO_VERSION 1
  6. #define BOOST_CHRONO_VERSION 2
  7. #include <iostream>
  8. #include <boost/rational.hpp>
  9. #include <boost/chrono/chrono.hpp>
  10. //#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
  11. #include <boost/chrono/chrono_io.hpp>
  12. int main()
  13. {
  14. {
  15. typedef boost::chrono::duration<float> RationalSeconds;
  16. RationalSeconds d(0.5);
  17. std::cout << d << std::endl;
  18. }
  19. {
  20. typedef boost::chrono::duration<boost::rational<int> > RationalSeconds;
  21. RationalSeconds d;
  22. std::cout << d << std::endl;
  23. }
  24. return 0;
  25. }