1#include <userver/proto-structs/duration.hpp>
5#include <userver/proto-structs/exceptions.hpp>
6#include <userver/utils/impl/internal_tag.hpp>
10namespace proto_structs {
12Duration::Duration(utils::impl::InternalTag, std::int64_t seconds, std::int32_t nanos)
13 : Duration(std::chrono::seconds{seconds}, std::chrono::nanoseconds{nanos}) {}
15void Duration::ThrowError(
const std::chrono::seconds& seconds,
const std::chrono::nanoseconds& nanos) {
16 throw ValueError(fmt::format(
"Duration '{}s.{}ns' is invalid or out of range", seconds.count(), nanos.count()));
19void Duration::ThrowError(
const char* reason) {
throw ValueError(reason); }