Boost logo

Boost Users :

From: Christopher Lux (christopherlux_at_[hidden])
Date: 2007-06-02 16:02:23


Jeff Garland <jeff_at_[hidden]> wrote:

> Sorry for the slow response...

No Problem ;)

>> i am trying to use date_time with nanosec resolution for the fractional seconds part. So i define BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
>> in my projects using date_time. Now i get the compiler warning below. I found out that the problem in the
>> said function is that in boost/date_time/date_duration.hpp the struct duration_traits_adapted defines
>> the int_type as long and not as int_64t.
>
> Right, it doesn't need to be 64 bits and you really shouldn't pay for that.

I think the problem is, that in the posix_time the correct 64bit integer type is used and in the gregorion part only long is defined (boost/date_time/date_duration.hpp the struct duration_traits_adapted). Now in the time_system_split.hpp file the operations for adding and substracting time durations (posix_time) to dates is defined and this is generating the warning. In the substraction method a static_cast is exactly at the place where in the addition method the warning is generated.

I do no know if there is a situation where this issue can make problems but i think it would not hurt to have the add and sub calculations done in the bigger value range to counter all possible problems.

> What version of boost are you using b/c AFAICT, int_type should be 64 bits if
> things are setup correctly. That is, you should be selecting this set of traits:

I am using the 1.34 release.

> //! traits struct for time_resolution_traits implementation type
> struct time_resolution_traits_adapted64_impl {
> typedef boost::int64_t int_type;

I use boost::posix_time::ptime and as far as i can see this is the relolution i have, but as i said the problem is that in the split_time calculations convertions are done to long which is defined in the duration traits of the date part of the lib.

Now the question is if a simple cast is enough or does there have to be a correct calculation in the split time funktions.

regards
-chris

-- 
Christopher Lux |
                 | Bauhaus University Weimar
                 | Faculty of Media - Virtual Reality Systems Group

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