1 #pragma once 2 3 #include "types/duration_types.hpp" 4 5 #include <boost/serialization/strong_typedef.hpp> 6 #include <nlohmann/json.hpp> 7 8 #include <chrono> 9 #include <cstdint> 10 BOOST_STRONG_TYPEDEF(Milliseconds,CollectionDuration)11BOOST_STRONG_TYPEDEF(Milliseconds, CollectionDuration) 12 13 inline void to_json(nlohmann::json& json, const CollectionDuration& value) 14 { 15 json = value.t.count(); 16 } 17 from_json(const nlohmann::json & json,CollectionDuration & value)18inline void from_json(const nlohmann::json& json, CollectionDuration& value) 19 { 20 value = CollectionDuration(Milliseconds(json.get<uint64_t>())); 21 } 22