Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81045 - in trunk: boost/chrono boost/chrono/io libs/chrono/test/io
From: vicente.botet_at_[hidden]
Date: 2012-10-22 13:07:54


Author: viboes
Date: 2012-10-22 13:07:52 EDT (Mon, 22 Oct 2012)
New Revision: 81045
URL: http://svn.boost.org/trac/boost/changeset/81045

Log:
Chrono: disable the time_point<system_clock> i/o specialization
Text files modified:
   trunk/boost/chrono/config.hpp | 7 +++++++
   trunk/boost/chrono/io/time_point_io.hpp | 4 ++++
   trunk/libs/chrono/test/io/time_point_input.cpp | 2 +-
   trunk/libs/chrono/test/io/time_point_output.cpp | 10 +++++-----
   4 files changed, 17 insertions(+), 6 deletions(-)

Modified: trunk/boost/chrono/config.hpp
==============================================================================
--- trunk/boost/chrono/config.hpp (original)
+++ trunk/boost/chrono/config.hpp 2012-10-22 13:07:52 EDT (Mon, 22 Oct 2012)
@@ -25,6 +25,13 @@
 #define BOOST_USE_WINDOWS_H
 #endif
 
+#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \
+ && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
+
+# define BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
+
+#endif
+
 // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
 // can be defined by the user to specify which API should be used
 

Modified: trunk/boost/chrono/io/time_point_io.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_io.hpp (original)
+++ trunk/boost/chrono/io/time_point_io.hpp 2012-10-22 13:07:52 EDT (Mon, 22 Oct 2012)
@@ -708,6 +708,7 @@
 #endif
     } // detail
 
+#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
     template <class CharT, class Traits, class Duration>
     std::basic_ostream<CharT, Traits>&
     operator<<(std::basic_ostream<CharT, Traits>& os, const time_point<system_clock, Duration>& tp)
@@ -838,6 +839,7 @@
       //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
       return os;
     }
+#endif
 
     namespace detail
     {
@@ -901,6 +903,7 @@
 
     } // detail
 
+#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
     template <class CharT, class Traits, class Duration>
     std::basic_istream<CharT, Traits>&
     operator>>(std::basic_istream<CharT, Traits>& is, time_point<system_clock, Duration>& tp)
@@ -1034,6 +1037,7 @@
       }
       return is;
     }
+#endif
 #endif //UTC
   } // chrono
 

Modified: trunk/libs/chrono/test/io/time_point_input.cpp
==============================================================================
--- trunk/libs/chrono/test/io/time_point_input.cpp (original)
+++ trunk/libs/chrono/test/io/time_point_input.cpp 2012-10-22 13:07:52 EDT (Mon, 22 Oct 2012)
@@ -147,7 +147,7 @@
   check_all<boost::chrono::steady_clock> ();
 #endif
   std::cout << "system_clock=" << std::endl;
-#if BOOST_CHRONO_VERSION >= 2
+#if BOOST_CHRONO_VERSION >= 2 && defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
   check_all_system_clock();
 #else
   check_all<boost::chrono::system_clock> ();

Modified: trunk/libs/chrono/test/io/time_point_output.cpp
==============================================================================
--- trunk/libs/chrono/test/io/time_point_output.cpp (original)
+++ trunk/libs/chrono/test/io/time_point_output.cpp 2012-10-22 13:07:52 EDT (Mon, 22 Oct 2012)
@@ -41,7 +41,7 @@
 {
   std::ostringstream out;
   boost::chrono::time_point<Clock, D> tp(d);
-#if BOOST_CHRONO_VERSION==2
+#if BOOST_CHRONO_VERSION>=2
   out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << tp;
 #else
   out << boost::chrono::duration_short << tp;
@@ -96,7 +96,7 @@
   using namespace boost::chrono;
   using namespace boost;
 
-#if BOOST_CHRONO_VERSION==2
+#if BOOST_CHRONO_VERSION>=2
   test_good<Clock>("2 hours", hours(2), duration_style::prefix);
   test_good<Clock>("2 h", hours(2), duration_style::symbol);
 #endif
@@ -114,7 +114,7 @@
   test_good_prefix<Clock> ("2 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (2));
 
   test_good_symbol<Clock> ("2 h", hours(2));
-#if BOOST_CHRONO_VERSION==2
+#if BOOST_CHRONO_VERSION>=2
   test_good_symbol<Clock>("2 min", minutes(2));
 #else
   test_good_symbol<Clock> ("2 m", minutes(2));
@@ -126,7 +126,7 @@
   test_good_symbol<Clock> ("2 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (2));
 }
 
-#if BOOST_CHRONO_VERSION==2
+#if BOOST_CHRONO_VERSION >= 2
 void check_all_system_clock()
 {
   using namespace boost::chrono;
@@ -166,7 +166,7 @@
   check_all<boost::chrono::steady_clock> ();
 #endif
   std::cout << "system_clock=" << std::endl;
-#if BOOST_CHRONO_VERSION==2
+#if BOOST_CHRONO_VERSION >= 2 && defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
   check_all_system_clock();
 #else
   check_all<boost::chrono::system_clock> ();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk