Ticket #6361 (closed Bugs: fixed)
integer overflow in boost::chrono::process_real_cpu_clock::now() under Windows 32bits
|Reported by:||ivan.lelann@…||Owned by:||viboes|
As of 1.48 Boost.Chrono contains code below for boost::chrono::process_real_cpu_clock::now() (boost\chrono\detail\inlined\win\process_cpu_clocks.hpp)
clock_t c = ::clock(); /* ... */ return time_point(
duration::rep is int64/nanoseconds, clock_t is long. This is under VS2008, Win XP 32bits. I think "c" should be cast to duration::rep before being multiplied.
C-style cast fixed the problem for me. Howard Hinnant suggested following cleaner fix on the mailing list :
typedef ratio_divide<giga, ratio<CLOCKS_PER_SEC>>::type R; return time_point(
NB: This appears at least twice in this file. It also appears in "mac" and "posix" folders though I cannot say if it is problematic on this platforms.
- Status changed from new to assigned
- Milestone changed from To Be Determined to Boost 1.50.0