Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-06-02 11:46:42


Christopher Lux wrote:

Sorry for the slow response...

> Hi,
> 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.

> The warning is generated in the add_time_duration() funtion of the split_timedate_system class. So i imagine
> that this is a bigger issue, because if the durations get bigger than what a long can hold (what will happen
> fast with nanosec resolution) the problems will come.
>
> Can this be resolved with an small fix to the duration_traits_adapted struct or have there to be more fixes?
>
> Here the compiler warning (VS.net 2005 SP1)
>
> boost\boost/date_time/time_system_split.hpp(189) : warning C4244: 'initializing' : conversion from '__int64' to 'long',
> possible loss of data

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:

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

which should give you 64 bits? But clearly, something else is going on...

Jeff


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