Boost logo

Boost Users :

Subject: [Boost-users] [DateTime] overflow in posix_time::microseconds
From: gast128 (gast128_at_[hidden])
Date: 2010-12-02 08:15:22


Hello all,

we encountered an overflow in posix_time::microseconds:

//about 40 years (1970-2010)
const __int64 n = 1267195987000000;
boost::posix_time::microseconds td(n); //overflow

The overflow is easy explainable since date_time::subsecond_duration first
multiplies it causing the overflow and then divides by 1000000.

There are already multiple posts spended on this, but I saw no definitive
answer. Can someone help? Alternatively we could work around it by first
divide the hour part out of it (which makes the number smaller) before adding
to a ptime, but preferably we would like this to see solved in the library
itself.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net