Go to the documentation of this file.
19 #ifndef GRPCPP_SUPPORT_TIME_H
20 #define GRPCPP_SUPPORT_TIME_H
29 #include "absl/time/clock.h"
30 #include "absl/time/time.h"
69 explicit TimePoint(absl::Time time) : time_(TimeToGprTimespec(time)) {}
75 if (time == absl::InfiniteFuture()) {
78 if (time == absl::InfinitePast()) {
83 timespec t = absl::ToTimespec(time);
85 spec.
tv_nsec =
static_cast<int32_t
>(t.tv_nsec);
101 const std::chrono::high_resolution_clock::time_point& from,
110 TimePoint(
const std::chrono::system_clock::time_point& time) {
134 if (absl::time_internal::IsInfiniteDuration(dur)) {
135 if (dur > absl::ZeroDuration()) {
142 timespec t = absl::ToTimespec(dur);
145 span.
tv_nsec =
static_cast<int32_t
>(t.tv_nsec);
152 #endif // GRPCPP_SUPPORT_TIME_H
int32_t tv_nsec
Definition: time.h:49
int64_t tv_sec
Definition: time.h:48
TimePoint(absl::Time time)
Definition: time.h:69
GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type)
The far past.
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
@ GPR_CLOCK_MONOTONIC
Monotonic clock.
Definition: time.h:33
TimePoint(const std::chrono::system_clock::time_point &time)
Definition: time.h:110
gpr_timespec DeadlineFromDuration(absl::Duration dur)
Definition: time.h:133
gpr_timespec raw_time() const
Definition: time.h:113
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
The far future.
@ GPR_TIMESPAN
Unmeasurable clock type: no base, created by taking the difference between two times.
Definition: time.h:42
TimePoint(const gpr_timespec &time)
Definition: time.h:59
gpr_timespec GprTimeSpecFromTime(absl::Time)
gpr_timespec raw_time()=delete
gpr_timespec raw_time() const
Definition: time.h:71
absl::Time TimeFromGprTimespec(gpr_timespec time)
gpr_clock_type clock_type
Against which clock was this time measured? (or GPR_TIMESPAN if this is a relative time measure)
Definition: time.h:52
GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b)
Add and subtract times.
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
Return the current time measured from the given clocks epoch.
Definition: async_unary_call.h:410
void Timepoint2Timespec(const std::chrono::system_clock::time_point &from, gpr_timespec *to)
void TimepointHR2Timespec(const std::chrono::high_resolution_clock::time_point &from, gpr_timespec *to)
gpr_timespec raw_time()
Definition: time.h:60
gpr_timespec GprTimeSpecFromDuration(absl::Duration)
TimePoint(const T &)=delete
Analogous to struct timespec.
Definition: time.h:47
absl::Duration DurationFromGprTimespec(gpr_timespec time)
@ GPR_CLOCK_REALTIME
Realtime clock.
Definition: time.h:36
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:45