Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77545 - trunk/boost/chrono/detail/inlined/win
From: vicente.botet_at_[hidden]
Date: 2012-03-25 15:43:20


Author: viboes
Date: 2012-03-25 15:43:19 EDT (Sun, 25 Mar 2012)
New Revision: 77545
URL: http://svn.boost.org/trac/boost/changeset/77545

Log:
Chrono: Apply patch 6361: integer overflow in boost::chrono::process_real_cpu_clock::now() under Windows 32bits
Text files modified:
   trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp | 6 ++++--
   1 files changed, 4 insertions(+), 2 deletions(-)

Modified: trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp 2012-03-25 15:43:19 EDT (Sun, 25 Mar 2012)
@@ -34,8 +34,9 @@
     {
       BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
     }
+ typedef ratio_divide<giga, ratio<CLOCKS_PER_SEC> >::type R;
     return time_point(
- duration(c*(1000000000l/CLOCKS_PER_SEC))
+ duration(static_cast<rep>(c)*R::num/R::den)
     );
 }
 
@@ -56,8 +57,9 @@
     {
       ec.clear();
     }
+ typedef ratio_divide<giga, ratio<CLOCKS_PER_SEC> >::type R;
     return time_point(
- duration(c*(1000000000l/CLOCKS_PER_SEC))
+ duration(static_cast<rep>(c)*R::num/R::den)
     );
 }
 #endif


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