millisec_special_value.cpp 809 B

12345678910111213141516171819
  1. //
  2. // Copyright (c) 2017 James E. King III
  3. // Use, modification and distribution is subject to the
  4. // Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #include <boost/core/ignore_unused.hpp>
  8. #include <boost/date_time/posix_time/posix_time_duration.hpp>
  9. #include <boost/date_time/special_defs.hpp>
  10. int main()
  11. {
  12. using boost::date_time::pos_infin;
  13. using boost::posix_time::millisec;
  14. boost::ignore_unused(millisec(static_cast<boost::int64_t>(pos_infin))); // compiles: it's a number
  15. boost::ignore_unused(millisec(pos_infin)); // won't compile: not an integral
  16. return 1; // return an error if we actually run for some reason
  17. }