id summary reporter owner description type status milestone component version severity resolution keywords cc 11519 Strange value of ptime variable a0607892@… James E. King, III "The bug is produced by this example program: {{{ int main() { int n = ((20 * 2700 - 4000.0) / 20 / 300.0 + 0.5); boost::posix_time::ptime from; boost::posix_time::ptime beg = boost::posix_time::time_from_string(""2015-07-29 11:40:00""); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5); beg = beg + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5) + boost::posix_time::minutes(5); for(int i = 7; i < n; i++) { from = beg + boost::posix_time::minutes(5 * i); if(from!=beg+ boost::posix_time::minutes(5 * i)) std::cout << ""ERROR IN TIME: "" << boost::posix_time::to_iso_extended_string(from) << std::endl << boost::posix_time::to_iso_extended_string(beg+ boost::posix_time::minutes(5 * i)) << std::endl; } return 0; } }}} The result of this code is that it reaches the output (although it shouldn't) and outputs a strange value for ''from''. I compiled this sample file with g++ 4.6.3 on Ubuntu 12.04 with the compiler flags ''-O3'' and ''-frounding-math''. Although ''-frounding-math'' is necessary to produce this bug for this small example, in a much larger program the bug is still there without this flag. While debugging this code it seems for me that in {{{ from = beg + boost::posix_time::minutes(5 * i); }}} the minutes are never initialized (but debugging with optimization is quite difficult)." Bugs closed To Be Determined date_time Boost 1.58.0 Problem invalid