17#ifndef KUDU_UTIL_MONOTIME_H
18#define KUDU_UTIL_MONOTIME_H
27#ifdef KUDU_HEADERS_NO_STUBS
28#include <gtest/gtest_prod.h>
30#include "kudu/gutil/port.h"
34#include "kudu/client/stubs.h"
37#include "kudu/util/kudu_export.h"
47#define KUDU_MONOTIME_NOEXCEPT noexcept
49#define KUDU_MONOTIME_NOEXCEPT
176 static const int64_t kUninitialized;
184 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
203 static const int64_t kNanosecondsPerSecond = 1000000000L;
206 static const int64_t kNanosecondsPerMillisecond = 1000000L;
209 static const int64_t kNanosecondsPerMicrosecond = 1000L;
212 static const int64_t kMicrosecondsPerSecond = 1000000L;
236 ATTRIBUTE_DEPRECATED(
"use std::min() instead");
243 bool Initialized() const;
274 std::
string ToString() const;
281 void ToTimeSpec(struct timespec* ts) const;
312 FRIEND_TEST(TestMonoTime, TestTimeSpec);
313 FRIEND_TEST(TestMonoTime, TestDeltaConversions);
315 explicit
MonoTime(const struct timespec& ts) KUDU_MONOTIME_NOEXCEPT;
316 explicit
MonoTime(int64_t nanos) KUDU_MONOTIME_NOEXCEPT;
317 double ToSeconds() const;
331void KUDU_EXPORT SleepFor(const
MonoDelta& delta);
506std::ostream& operator<<(std::ostream& os, const kudu::
MonoTime& time);
A representation of a time interval.
Definition monotime.h:58
friend MonoDelta operator+(const MonoDelta &, const MonoDelta &)
int64_t ToNanoseconds() const
MonoDelta & operator-=(const MonoDelta &delta)
MonoDelta & operator+=(const MonoDelta &delta)
void ToTimeVal(struct timeval *tv) const
int64_t ToMicroseconds() const
static void NanosToTimeSpec(int64_t nanos, struct timespec *ts)
bool LessThan(const MonoDelta &rhs) const
static MonoDelta FromSeconds(double seconds)
std::string ToString() const
friend MonoDelta operator-(const MonoDelta &, const MonoDelta &)
int64_t ToMilliseconds() const
static MonoDelta FromMilliseconds(int64_t ms)
static MonoDelta FromMicroseconds(int64_t us)
void ToTimeSpec(struct timespec *ts) const
bool MoreThan(const MonoDelta &rhs) const
static MonoDelta FromNanoseconds(int64_t ns)
bool Equals(const MonoDelta &rhs) const
Representation of a particular point in time.
Definition monotime.h:197
MonoTime() KUDU_MONOTIME_NOEXCEPT
static const MonoTime & Earliest(const MonoTime &a, const MonoTime &b)