Boost logo

Boost Users :

From: Christopher Lux (christopherlux_at_[hidden])
Date: 2007-05-31 05:39:06


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.

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
         D:\_devel\schism_wc_x86\schism\projects\cmake\..\..\ext\inc\boost\boost/date_time/time_system_split.hpp(180) : while compiling class template member function 'boost::posix_time::simple_time_rep boost::date_time::split_timedate_system<config>::add_time_duration(const boost::posix_time::simple_time_rep &,boost::posix_time::time_duration)'
         with
         [
             config=boost::posix_time::posix_time_system_config
         ]
         D:\_devel\schism_wc_x86\schism\projects\cmake\..\..\ext\inc\boost\boost/date_time/time.hpp(52) : see reference to class template instantiation 'boost::date_time::split_timedate_system<config>' being compiled
         with
         [
             config=boost::posix_time::posix_time_system_config
         ]
         D:\_devel\schism_wc_x86\schism\projects\cmake\..\..\ext\inc\boost\boost/date_time/posix_time/ptime.hpp(32) : see reference to class template instantiation 'boost::date_time::base_time<T,time_system>' being compiled
         with
         [
             T=boost::posix_time::ptime,
             time_system=boost::posix_time::posix_time_system
         ]

-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