Created
July 4, 2021 12:09
-
-
Save Akaame/ba9bd680d94b30c48c9a79fd7158b23e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace boost { | |
namespace archive { | |
template<typename Archive, typename Rep, typename Period> | |
void load(Archive& ar, std::chrono::duration<Rep, Period> dur, const unsigned int version) { | |
int64_t duration; | |
ar >> duration; | |
dur = std::chrono::duration<Rep, Period>(duration); | |
} | |
template<typename Archive, typename Rep, typename Period> | |
void save(Archive& ar, std::chrono::duration<Rep, Period> dur, const unsigned int version) { | |
auto duration = std::chrono::duration_cast<std::chrono::milliseconds, Rep, Period>(dur).count(); | |
ar << duration; | |
} | |
template<typename Archive, typename Rep, typename Period> | |
inline void serialize(Archive& ar, std::chrono::duration<Rep, Period>& dur, const unsigned int version) { | |
boost::serialization::split_free(ar, dur, version); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment