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