Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "types/milliseconds.hpp" |
| 4 | |
| 5 | #include <boost/serialization/strong_typedef.hpp> |
| 6 | #include <nlohmann/json.hpp> |
| 7 | |
| 8 | #include <chrono> |
| 9 | |
| 10 | BOOST_STRONG_TYPEDEF(Milliseconds, CollectionDuration) |
| 11 | |
| 12 | inline void to_json(nlohmann::json& json, const CollectionDuration& value) |
| 13 | { |
| 14 | json = value.t.count(); |
| 15 | } |
| 16 | |
| 17 | inline void from_json(const nlohmann::json& json, CollectionDuration& value) |
| 18 | { |
| 19 | value = CollectionDuration(Milliseconds(json.get<uint64_t>())); |
| 20 | } |