Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68380 - trunk/boost/chrono/detail/inlined/win
From: vicente.botet_at_[hidden]
Date: 2011-01-23 09:38:47


Author: viboes
Date: 2011-01-23 09:38:46 EST (Sun, 23 Jan 2011)
New Revision: 68380
URL: http://svn.boost.org/trac/boost/changeset/68380

Log:
Boost.Chrono: Try to solve some msvc9.0 issues related to enable_if on duration overloading

Text files modified:
   trunk/boost/chrono/detail/inlined/win/chrono.hpp | 37 ++++++++++++++++++++++---------------
   1 files changed, 22 insertions(+), 15 deletions(-)

Modified: trunk/boost/chrono/detail/inlined/win/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/chrono.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/chrono.hpp 2011-01-23 09:38:46 EST (Sun, 23 Jan 2011)
@@ -38,7 +38,7 @@
     static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
 
     boost::detail::win32::LARGE_INTEGER_ pcount;
- if ( (nanosecs_per_tic <= 0.0L) ||
+ if ( (nanosecs_per_tic <= 0.0L) ||
             (!boost::detail::win32::QueryPerformanceCounter( &pcount )) )
     {
         boost::detail::win32::DWORD_ cause =
@@ -46,14 +46,21 @@
                     ? ERROR_NOT_SUPPORTED
                     : boost::detail::win32::GetLastError());
         boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ cause,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                         "chrono::steady_clock" ));
     }
 
+#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
+ // trying to simplify expression (Pb. with MSVC.9.0)
+ steady_clock::rep r = static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart);
+ steady_clock::duration d(r);
+ return steady_clock::time_point(d);
+#else
     return steady_clock::time_point(steady_clock::duration(
       static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart)));
+#endif
   }
 
 
@@ -62,28 +69,28 @@
     static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
 
     boost::detail::win32::LARGE_INTEGER_ pcount;
- if ( (nanosecs_per_tic <= 0.0L)
+ if ( (nanosecs_per_tic <= 0.0L)
             || (!boost::detail::win32::QueryPerformanceCounter( &pcount )) )
     {
- boost::detail::win32::DWORD_ cause =
- ((nanosecs_per_tic <= 0.0L)
- ? ERROR_NOT_SUPPORTED
+ boost::detail::win32::DWORD_ cause =
+ ((nanosecs_per_tic <= 0.0L)
+ ? ERROR_NOT_SUPPORTED
                     : boost::detail::win32::GetLastError());
         if (BOOST_CHRONO_IS_THROWS(ec)) {
             boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ cause,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
                             "chrono::steady_clock" ));
- }
- else
+ }
+ else
         {
             ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
             return steady_clock::time_point(duration(0));
         }
     }
 
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
     {
         ec.clear();
     }
@@ -105,7 +112,7 @@
   {
     boost::detail::win32::FILETIME_ ft;
     boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
     {
         ec.clear();
     }


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