17 #ifndef KUDU_UTIL_MONOTIME_H 18 #define KUDU_UTIL_MONOTIME_H 26 #ifdef KUDU_HEADERS_NO_STUBS 27 #include <gtest/gtest_prod.h> 29 #include "kudu/gutil/port.h" 33 #include "kudu/client/stubs.h" 36 #include "kudu/util/kudu_export.h" 46 #define KUDU_MONOTIME_NOEXCEPT noexcept 48 #define KUDU_MONOTIME_NOEXCEPT 49 #endif // #ifdef LANG_CXX11 ... #else ... 67 static MonoDelta FromSeconds(
double seconds);
68 static MonoDelta FromMilliseconds(int64_t ms);
69 static MonoDelta FromMicroseconds(int64_t us);
70 static MonoDelta FromNanoseconds(int64_t ns);
80 bool Initialized()
const;
88 bool LessThan(
const MonoDelta &rhs)
const;
96 bool MoreThan(
const MonoDelta &rhs)
const;
108 std::string ToString()
const;
115 double ToSeconds()
const;
116 int64_t ToMilliseconds()
const;
117 int64_t ToMicroseconds()
const;
118 int64_t ToNanoseconds()
const;
126 void ToTimeVal(
struct timeval *tv)
const;
133 void ToTimeSpec(
struct timespec *ts)
const;
141 static void NanosToTimeSpec(int64_t nanos,
struct timespec* ts);
144 static const int64_t kUninitialized;
148 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
166 static const int64_t kNanosecondsPerSecond = 1000000000L;
167 static const int64_t kNanosecondsPerMillisecond = 1000000L;
168 static const int64_t kNanosecondsPerMicrosecond = 1000L;
170 static const int64_t kMicrosecondsPerSecond = 1000000L;
194 ATTRIBUTE_DEPRECATED(
"use std::min() instead");
201 bool Initialized()
const;
214 "use kudu::operator-(const MonoTime&, const MonoTime&) instead");
229 bool ComesBefore(
const MonoTime &rhs)
const;
232 std::string ToString()
const;
239 void ToTimeSpec(
struct timespec* ts)
const;
247 bool Equals(
const MonoTime& other)
const;
270 FRIEND_TEST(TestMonoTime, TestTimeSpec);
271 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
273 explicit MonoTime(
const struct timespec &ts) KUDU_MONOTIME_NOEXCEPT;
274 explicit MonoTime(int64_t nanos) KUDU_MONOTIME_NOEXCEPT;
275 double ToSeconds()
const;
289 void KUDU_EXPORT SleepFor(
const MonoDelta& delta);
Definition: callbacks.h:28
Representation of a particular point in time.
Definition: monotime.h:161
A representation of a time interval.
Definition: monotime.h:57