17 #ifndef KUDU_UTIL_MONOTIME_H 18 #define KUDU_UTIL_MONOTIME_H 23 #ifdef KUDU_HEADERS_NO_STUBS 24 #include <gtest/gtest_prod.h> 28 #include "kudu/client/stubs.h" 31 #include "kudu/util/kudu_export.h" 53 static MonoDelta FromSeconds(
double seconds);
54 static MonoDelta FromMilliseconds(int64_t ms);
55 static MonoDelta FromMicroseconds(int64_t us);
56 static MonoDelta FromNanoseconds(int64_t ns);
66 bool Initialized()
const;
74 bool LessThan(
const MonoDelta &rhs)
const;
82 bool MoreThan(
const MonoDelta &rhs)
const;
94 std::string ToString()
const;
101 double ToSeconds()
const;
102 int64_t ToMilliseconds()
const;
103 int64_t ToMicroseconds()
const;
104 int64_t ToNanoseconds()
const;
112 void ToTimeVal(
struct timeval *tv)
const;
119 void ToTimeSpec(
struct timespec *ts)
const;
127 static void NanosToTimeSpec(int64_t nanos,
struct timespec* ts);
130 static const int64_t kUninitialized;
133 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
151 static const int64_t kNanosecondsPerSecond = 1000000000L;
152 static const int64_t kNanosecondsPerMillisecond = 1000000L;
153 static const int64_t kNanosecondsPerMicrosecond = 1000L;
155 static const int64_t kMicrosecondsPerSecond = 1000000L;
183 bool Initialized()
const;
207 bool ComesBefore(
const MonoTime &rhs)
const;
210 std::string ToString()
const;
218 bool Equals(
const MonoTime& other)
const;
240 FRIEND_TEST(TestMonoTime, TestTimeSpec);
241 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
243 explicit MonoTime(
const struct timespec &ts);
245 double ToSeconds()
const;
259 void KUDU_EXPORT SleepFor(
const MonoDelta& delta);
Definition: callbacks.h:28
Representation of a particular point in time.
Definition: monotime.h:146
A representation of a time interval.
Definition: monotime.h:43