Ticket #2809 (closed Bugs: fixed)
[patch] Date Time exception with MinGW
|Reported by:||Claudio Bley||Owned by:||az_sw_dude|
I'm using Boost version 1.38 under Windows using MinGW.
When trying to use the this_thread::sleep function I got the following exception:
"could not convert calendar time to UTC time"
During compilation I received the following compiler warning:
../../../../boost/date_time/filetime_functions.hpp: In function `uint64_t boost::date_time::winapi::file_time_to_microseconds(const FileTimeT&)': ../../../../boost/date_time/filetime_functions.hpp:101: warning: left shift count >= width of type
regarding the following code:
const uint64_t c1 = 27111902UL; const uint64_t c2 = 3577643008UL; const uint64_t shift = (c1 << (32)) + c2; // issues warning without 'UL'
It seems GCC over-optimizes this case as it replaces the variables with the corresponding literal values. Since 27111902UL is just an unsigned long (not an unsigned long long) it is only 32 bit wide (on my machine) -- leading to the compiler warning above.
To fix this issue, the literals need to be written using the ULL suffix or the suggested patch (attached) needs to be applied.
- Owner set to az_sw_dude
- Component changed from None to date_time