| 1 | // test_special_values.cpp ----------------------------------------------------------// |
| 2 | |
| 3 | // Copyright 2008 Howard Hinnant |
| 4 | // Copyright 2008 Beman Dawes |
| 5 | // Copyright 2009 Vicente J. Botet Escriba |
| 6 | |
| 7 | // Distributed under the Boost Software License, Version 1.0. |
| 8 | // See http://www.boost.org/LICENSE_1_0.txt |
| 9 | |
| 10 | /* |
| 11 | This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which |
| 12 | was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. |
| 13 | Many thanks to Howard for making his code available under the Boost license. |
| 14 | The original code was modified to conform to Boost conventions and to section |
| 15 | 20.9 Time utilities [time] of the C++ committee's working paper N2798. |
| 16 | See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. |
| 17 | |
| 18 | time2_demo contained this comment: |
| 19 | |
| 20 | Much thanks to Andrei Alexandrescu, |
| 21 | Walter Brown, |
| 22 | Peter Dimov, |
| 23 | Jeff Garland, |
| 24 | Terry Golubiewski, |
| 25 | Daniel Krugler, |
| 26 | Anthony Williams. |
| 27 | */ |
| 28 | |
| 29 | #include <boost/chrono/chrono.hpp> |
| 30 | #include <boost/type_traits.hpp> |
| 31 | |
| 32 | #include <iostream> |
| 33 | |
| 34 | using namespace boost::chrono; |
| 35 | |
| 36 | void test_special_values() |
| 37 | { |
| 38 | std::cout << "duration<unsigned>::min().count() = " << ((duration<unsigned>::min)()).count() << '\n'; |
| 39 | std::cout << "duration<unsigned>::zero().count() = " << duration<unsigned>::zero().count() << '\n'; |
| 40 | std::cout << "duration<unsigned>::max().count() = " << ((duration<unsigned>::max)()).count() << '\n'; |
| 41 | std::cout << "duration<int>::min().count() = " << ((duration<int>::min)()).count() << '\n'; |
| 42 | std::cout << "duration<int>::zero().count() = " << duration<int>::zero().count() << '\n'; |
| 43 | std::cout << "duration<int>::max().count() = " << ((duration<int>::max)()).count() << '\n'; |
| 44 | } |
| 45 | |
| 46 | int main() |
| 47 | { |
| 48 | test_special_values(); |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | |