void save(Archive & ar, 
          const posix_time::time_duration& td, 
          unsigned int version)
{
  typename posix_time::time_duration::hour_type h = td.hours();
  typename posix_time::time_duration::min_type m = td.minutes();
  typename posix_time::time_duration::sec_type s = td.seconds();
  typename posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
  ar & make_nvp("time_duration_hours", h);
  ar & make_nvp("time_duration_minutes", m);
  ar & make_nvp("time_duration_seconds", s);
  ar & make_nvp("time_duration_fractional_seconds", fs);
}
예제 #2
0
void save(Archive & ar, 
          const posix_time::time_duration& td, 
          unsigned int /*version*/)
{
  // serialize a bool so we know how to read this back in later
  bool is_special = td.is_special();
  ar & make_nvp("is_special", is_special);
  if(is_special) {
    std::string s = to_simple_string(td);
    ar & make_nvp("sv_time_duration", s);
  }
  else {
    typename posix_time::time_duration::hour_type h = td.hours();
    typename posix_time::time_duration::min_type m = td.minutes();
    typename posix_time::time_duration::sec_type s = td.seconds();
    typename posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
    ar & make_nvp("time_duration_hours", h);
    ar & make_nvp("time_duration_minutes", m);
    ar & make_nvp("time_duration_seconds", s);
    ar & make_nvp("time_duration_fractional_seconds", fs);
  }
}