diff options
Diffstat (limited to 'boost/date_time/time_resolution_traits.hpp')
-rw-r--r-- | boost/date_time/time_resolution_traits.hpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/boost/date_time/time_resolution_traits.hpp b/boost/date_time/time_resolution_traits.hpp index 7ba42c20b5..b622488005 100644 --- a/boost/date_time/time_resolution_traits.hpp +++ b/boost/date_time/time_resolution_traits.hpp @@ -60,6 +60,29 @@ namespace date_time { static bool is_adapted() { return true;} }; + // + // Note about var_type, which is used to define the variable that + // stores hours, minutes, and seconds values: + // + // In Boost 1.65.1 and earlier var_type was boost::int32_t which suffers + // the year 2038 problem. Binary serialization of posix_time uses + // 32-bit values, and uses serialization version 0. + // + // In Boost 1.66.0 the var_type changed to std::time_t, however + // binary serialization was not properly versioned, so on platforms + // where std::time_t is 32-bits, it remains compatible, however on + // platforms where std::time_t is 64-bits, binary serialization ingest + // will be incompatible with previous versions. Furthermore, binary + // serialized output from 1.66.0 will not be compatible with future + // versions. Yes, it's a mess. Static assertions were not present + // in the serialization code to protect against this possibility. + // + // In Boost 1.67.0 the var_type was changed to boost::int64_t, + // ensuring the output size is 64 bits, and the serialization version + // was bumped. Static assertions were added as well, protecting + // future changes in this area. + // + template<typename frac_sec_type, time_resolutions res, #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) @@ -68,7 +91,7 @@ namespace date_time { typename frac_sec_type::int_type resolution_adjust, #endif unsigned short frac_digits, - typename var_type = std::time_t > + typename var_type = boost::int64_t > // see note above class time_resolution_traits { public: typedef typename frac_sec_type::int_type fractional_seconds_type; |