#ifndef BOOST_SERIALIZATION_CHRONO_HPP #define BOOST_SERIALIZATION_CHRONO_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // serialization/chrono.hpp: // serialization for std::chrono templates #include #include //#include #include #include namespace boost { namespace serialization { /// serialization for std::chrono::duration template inline void serialize( Archive & ar, std::chrono::duration< Rep, Period > & t, const unsigned int file_version ){ boost::serialization::split_free(ar, t, file_version); } template inline void save( Archive & ar, std::chrono::duration< Rep, Period > const & t, const unsigned int /* file_version */ ){ ar << t.count(); } template inline void load( Archive & ar, std::chrono::duration< Rep, Period >& t, const unsigned int /* file_version */ ){ Rep rep; ar >> rep; t = std::chrono::duration(rep); } // specialization of serialization traits for std::chrono::duration template struct is_bitwise_serializable > : public is_bitwise_serializable< Rep > {}; template struct implementation_level > : mpl::int_ {} ; // treat just like builtin arithmetic types for tracking template struct tracking_level > : mpl::int_ {} ; /// serialization for std::chrono::time_point template // = typename C::duration> inline void serialize( Archive & ar, std::chrono::time_point< C,D > & t, const unsigned int file_version ){ boost::serialization::split_free(ar, t, file_version); } template // = typename C::duration> inline void save( Archive & ar, std::chrono::time_point< C, D > const & t, const unsigned int /* file_version */ ){ ar << t.time_since_epoch(); } template // = typename C::duration> inline void load( Archive & ar, std::chrono::time_point< C,D >& t, const unsigned int /* file_version */ ){ D dur; ar >> dur; t = std::chrono::time_point< C,D >(dur); } // specialization of serialization traits for std::chrono::time_point template // = typename C::duration> struct is_bitwise_serializable > : public is_bitwise_serializable< D > {}; template // = typename C::duration> struct implementation_level > : mpl::int_ {} ; // treat just like builtin arithmetic types for tracking template // = typename C::duration> struct tracking_level > : mpl::int_ {} ; } // serialization } // namespace boost #endif // BOOST_SERIALIZATION_CHRONO_HPP