blob: ddeb9cc3916e50eb63e99ae65f3325944a9015d5 [file] [log] [blame]
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +00001#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
10BOOST_STRONG_TYPEDEF(Milliseconds, CollectionDuration)
11
12inline void to_json(nlohmann::json& json, const CollectionDuration& value)
13{
14 json = value.t.count();
15}
16
17inline void from_json(const nlohmann::json& json, CollectionDuration& value)
18{
19 value = CollectionDuration(Milliseconds(json.get<uint64_t>()));
20}