|
Boost Users : |
Subject: [Boost-users] Segfault when using date_time
From: Sara Siegal (ssiegal_at_[hidden])
Date: 2012-07-31 16:33:32
I attempted to rebuild my Boost installation with nanosecond support for
the date-time library. I did so by adding
BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG = 1 ;
to boost-build.jam and adding
<define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
to the jamfile in date_time/build. However, when I add this code to my
application and compile, it segfaults:
boost::posix_time::time_duration time1, time2;
time1=boost::posix_time::seconds(3);
std::cout << boost::posix_time::to_simple_string(time1) << std::endl;
time2=boost::posix_time::nanoseconds(987654321);
std::cout << boost::posix_time::to_simple_string(time2) << std::endl;
boost::this_thread::sleep(time2);
The segfault is at
/archive/home/ssiegal/test/include/boost/date_time/posix_time/posix_time_config.hpp:99:
(gdb) list
94 {
95 typedef gregorian::date date_type;
96 typedef time_duration time_duration_type;
97 simple_time_rep(date_type d, time_duration_type tod) :
98 day(d),
99 time_of_day(tod)
100 {
101 // make sure we have sane values for date & time
102 if(!day.is_special() && !time_of_day.is_special()){
103 if(time_of_day >= time_duration_type(24,0,0)) {
Anyone else ever see this? Is there anything else I need to do to turn on
nanosecond resolution?
Thanks very much!
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