Boost logo

Boost Users :

From: Andre du Toit (adutoit_at_[hidden])
Date: 2003-04-30 11:01:00


Hi.

Since time_duration uses <long> to represent each of the fields
(H:M:S:FS), I should be able to add any hour offset to a ptime, as long
as the resultant ptime is inside the date/time range representable by boost?

With the date ranges of boost being 1400-Jan-1 00:00:00 -> 10000-Jan-1
00:00:00, the number of hours between these dates is (very roughly!)
7.534E7. This is less than the <long> limit on my system, which is +/-
2.147E9. That is good.

So; doing the following:

ptime t_max( date(10000,Jan,1) );
ptime t_min( date(1400,Jan,1) );
time_duration td = t_max - t_min;
std::cout << to_simple_string( td ) << std::endl;

should produce something like :

7.534E7:0:0

or if you want to write it out:

7533600:0:0

not?

Instead; the output I get is :

224112:19:12.

This corresponds to a timespan of roughly 25 years which means I just
ran into some overflow/underflow problem somewhere. What gives?

What time range is supported by time_duration if it does not use the
<long> limits?

I have difficulty deducing this information from the header files, the
source for the lib is not too helpfull either!

What am I missing here?

Greetings,
Andre.


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