Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-07-14 18:38:03


Gennaro Prota wrote:
> Hi,
>
> the date_time library docs (posix_time.html) state:
>
> "The class boost::posix_time::ptime is the primary interface for
> time point manipulation. In general, the ptime class is immutable
> once constructed although it does allow assignment."
>
> Looking at the code it doesn't seem to me it allows assignment. Am I
> missing something?

Apparently. Have a look at the tests or examples. Just to pick one
example/time_math.cpp

   ptime t1(d, hours(5)+minutes(4)+seconds(2)+milliseconds(1));
   //construct a new time by subtracting some times
   ptime t2 = t1 - hours(5)- minutes(4)- seconds(2)- milliseconds(1);

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk