Boost logo

Boost Users :

From: Michal Lijowski (michal_at_[hidden])
Date: 2005-09-20 11:41:33


Is the only way to initialize date and ptime
using strings like
 date d(from_simple_string(s));

NOT stringstreams

        stringstream ss("2004-Jan-1");
        date;
        ss >> d;

 Michal

On Fri, 2005-09-16 at 16:36 -0700, Bart wrote:
> "Michal Lijowski" <michal_at_[hidden]> wrote in message
> news:1126883517.24859.2.camel_at_ml-cvu.wustl.edu...
> >I just started with date_time library using boost-1.33.0-3 on FC4 and
> > gcc 4.0.1 20050727.
> >
> > It is rpm version downloaded from
> > http://download.fedora.redhat.com/pub/fedora/linux/core/development/i386/Fedora/RPMS.
> >
> > I copied some lines of code from boost_date_time.pdf to get familiar
> > with capabilities of this library and I encountered some problems.
> >
> > Here is a modified code taken from page 3 of the manual
>
> ...snip...
>
> >
> > My question is why d and t0 are not-a-date-time?
> > Is this expected?
> >
>
> Yes, this is expected. The default constructors for date & ptime initialize
> to not_a_date_time.
>
> > Also the line
> >
> > ptime t1(d3, hours(5)+nanosec(100)); //date + time of day offset
> >
> > compiles with error: 'nanosec' was not declared in this scope
> >
>
> date_time can be compiled with either microsecond resolution or nanosecond
> resolution. If microsecond resolution (the default) was used, the nanosec
> code won't be available.
>
> To enable nanosecond resolution, simply define
> BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG.
>
> Bart
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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