aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/grpc/common/time_point.h
blob: c2b81262974c2e67c1b21eff5a62003acaf4ab6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <contrib/libs/grpc/include/grpcpp/support/time.h>

#include <util/datetime/base.h>

#include <chrono>

namespace grpc {
// Specialization of TimePoint for TInstant
template <>
class TimePoint<TInstant> : public TimePoint<std::chrono::system_clock::time_point> {
    using TChronoDuration = std::chrono::duration<TDuration::TValue, std::micro>;

public:
    TimePoint(const TInstant& time)
        : TimePoint<std::chrono::system_clock::time_point>(
              std::chrono::system_clock::time_point(
                  std::chrono::duration_cast<std::chrono::system_clock::duration>(
                      TChronoDuration(time.GetValue())))) {
    }
};
} // namespace grpc