Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74507 - trunk/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2011-09-21 18:25:33


Author: viboes
Date: 2011-09-21 18:25:32 EDT (Wed, 21 Sep 2011)
New Revision: 74507
URL: http://svn.boost.org/trac/boost/changeset/74507

Log:
Chrono: Make more portable round() code
Text files modified:
   trunk/boost/chrono/round.hpp | 10 +++++++++-
   1 files changed, 9 insertions(+), 1 deletions(-)

Modified: trunk/boost/chrono/round.hpp
==============================================================================
--- trunk/boost/chrono/round.hpp (original)
+++ trunk/boost/chrono/round.hpp 2011-09-21 18:25:32 EDT (Wed, 21 Sep 2011)
@@ -12,7 +12,8 @@
 #define BOOST_CHRONO_ROUND_HPP
 
 #include <boost/chrono/duration.hpp>
-#include <boost/chrono/typeof/boost/chrono/chrono.hpp>
+#include <boost/chrono/duration.hpp>
+//#include <boost/chrono/typeof/boost/chrono/chrono.hpp>
 
 namespace boost
 {
@@ -28,8 +29,15 @@
         To t0 = duration_cast<To>(d);
         To t1 = t0;
         ++t1;
+#if 0
+ // Avoid the user of BOOST_AUTO to make the library portable to Sun, PGI, ..
         BOOST_AUTO(diff0, d - t0);
         BOOST_AUTO(diff1, t1 - d);
+#else
+ typedef typename common_type<To, duration<Rep, Period> >::type result_type;
+ result_type diff0 = d - t0;
+ result_type diff1 = t1 - d;
+#endif
         if (diff0 == diff1)
         {
             if (t0.count() & 1)


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