blob: cdb9ff90792974390f834c87e3a91fd4824b8260 [file] [log] [blame]
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +00001#pragma once
2
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +01003#include "types/duration_types.hpp"
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +00004
5#include <boost/serialization/strong_typedef.hpp>
6#include <nlohmann/json.hpp>
7
8#include <chrono>
Krzysztof Grobelny80697712021-03-04 09:49:27 +00009#include <cstdint>
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000010
11BOOST_STRONG_TYPEDEF(Milliseconds, CollectionDuration)
12
13inline void to_json(nlohmann::json& json, const CollectionDuration& value)
14{
15 json = value.t.count();
16}
17
18inline void from_json(const nlohmann::json& json, CollectionDuration& value)
19{
20 value = CollectionDuration(Milliseconds(json.get<uint64_t>()));
21}