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" 54 static MonoDelta FromSeconds(
double seconds);
55 static MonoDelta FromMilliseconds(int64_t ms);
56 static MonoDelta FromMicroseconds(int64_t us);
57 static MonoDelta FromNanoseconds(int64_t ns);
67 bool Initialized()
const;
75 bool LessThan(
const MonoDelta &rhs)
const;
83 bool MoreThan(
const MonoDelta &rhs)
const;
95 std::string ToString()
const;
102 double ToSeconds()
const;
103 int64_t ToMilliseconds()
const;
104 int64_t ToMicroseconds()
const;
105 int64_t ToNanoseconds()
const;
113 void ToTimeVal(
struct timeval *tv)
const;
120 void ToTimeSpec(
struct timespec *ts)
const;
128 static void NanosToTimeSpec(int64_t nanos,
struct timespec* ts);
131 static const int64_t kUninitialized;
134 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
152 static const int64_t kNanosecondsPerSecond = 1000000000L;
153 static const int64_t kNanosecondsPerMillisecond = 1000000L;
154 static const int64_t kNanosecondsPerMicrosecond = 1000L;
156 static const int64_t kMicrosecondsPerSecond = 1000000L;
178 ATTRIBUTE_DEPRECATED(
"use std::min() instead");
185 bool Initialized()
const;
209 bool ComesBefore(
const MonoTime &rhs)
const;
212 std::string ToString()
const;
219 void ToTimeSpec(
struct timespec* ts)
const;
227 bool Equals(
const MonoTime& other)
const;
249 FRIEND_TEST(TestMonoTime, TestTimeSpec);
250 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
252 explicit MonoTime(
const struct timespec &ts);
254 double ToSeconds()
const;
268 void KUDU_EXPORT SleepFor(
const MonoDelta& delta);
Definition: callbacks.h:28
Representation of a particular point in time.
Definition: monotime.h:147
A representation of a time interval.
Definition: monotime.h:44