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);
150 static const int64_t kNanosecondsPerSecond = 1000000000L;
151 static const int64_t kNanosecondsPerMillisecond = 1000000L;
152 static const int64_t kNanosecondsPerMicrosecond = 1000L;
154 static const int64_t kMicrosecondsPerSecond = 1000000L;
182 bool Initialized()
const;
206 bool ComesBefore(
const MonoTime &rhs)
const;
209 std::string ToString()
const;
217 bool Equals(
const MonoTime& other)
const;
221 FRIEND_TEST(TestMonoTime, TestTimeSpec);
222 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
224 explicit MonoTime(
const struct timespec &ts);
226 double ToSeconds()
const;
void KUDU_EXPORT SleepFor(const MonoDelta &delta)
Representation of a particular point in time.
Definition: monotime.h:145
A representation of a time interval.
Definition: monotime.h:43