Serialization
The boost::date_time library is compatible with the boost::serialization library (currently in review for final acceptance into boost). The list of classes that are serializable are:
boost::gregorian
date
date_duration
date_period
partial_date
nth_day_of_week_in_month
first_day_of_week_in_month
last_day_of_week_in_month
first_day_of_week_before
first_day_of_week_after
greg_month
greg_day
greg_weekday
boost::posix_time
ptime
time_duration
time_period
Note* These classes have been tested with text_archives. The serialization routines were written with xml archives in mind, however, no tests are currently available (at time of writing xml archives were not parsed correctly). Xml archive tests will be added as soon as the problem is resolved.
No extra steps are required to build the date_time library for serialization use.
To use the date_time serialization code, the proper header files must be explicitly included. The header files are:
boost/date_time/gregorian/greg_serialize.hpp
and
boost/date_time/posix_time/time_serialize.hpp
Tests exist for serialization of the above mentioned classes but are not run by default. To run these test suites a global variable must be set on the command line.
bjam “-sBOOST_DATE_TIME_SERIALIZATION=true” ...
This will run the date_time_serialization suite along with the rest of the date_time tests.