Kudu C++ client API
Public Member Functions | Static Public Member Functions | List of all members
kudu::MonoTime Class Reference

Representation of a particular point in time. More...

#include <monotime.h>

Public Member Functions

 MonoTime () KUDU_MONOTIME_NOEXCEPT
 
bool Initialized () const
 
MonoDelta GetDeltaSince (const MonoTime &rhs) const
 
void AddDelta (const MonoDelta &delta)
 
bool ComesBefore (const MonoTime &rhs) const
 
std::string ToString () const
 
void ToTimeSpec (struct timespec *ts) const
 
bool Equals (const MonoTime &other) const
 
Syntactic sugar: increment/decrement operators for MonoTime.
MonoTimeoperator+= (const MonoDelta &delta)
 
MonoTimeoperator-= (const MonoDelta &delta)
 

Static Public Member Functions

static MonoTime Now ()
 
static MonoTime Max ()
 
static MonoTime Min ()
 
static const MonoTimeEarliest (const MonoTime &a, const MonoTime &b)
 

Static Public Attributes

Conversion constants for ubiquitous time units.
static const int64_t kNanosecondsPerSecond = 1000000000L
 Nanoseconds per second.
 
static const int64_t kNanosecondsPerMillisecond = 1000000L
 Nanoseconds per millisecond.
 
static const int64_t kNanosecondsPerMicrosecond = 1000L
 Nanoseconds per microseconds.
 
static const int64_t kMicrosecondsPerSecond = 1000000L
 Microseconds per second.
 

Detailed Description

Representation of a particular point in time.

The MonoTime class represents a particular point in time, relative to some fixed but unspecified reference point.

This time is monotonic, meaning that if the user changes his or her system clock, the monotime does not change.

Constructor & Destructor Documentation

◆ MonoTime()

kudu::MonoTime::MonoTime ( )

Build a MonoTime object. The resulting object is not initialized and not ready to use.

Member Function Documentation

◆ AddDelta()

void kudu::MonoTime::AddDelta ( const MonoDelta delta)

Advance this object's time specification by the specified interval.

Parameters
[in]deltaThe time interval to add.

◆ ComesBefore()

bool kudu::MonoTime::ComesBefore ( const MonoTime rhs) const

Check whether the point in time specified by this object is earlier than the specified one.

Parameters
[in]rhsThe other MonoTime object to compare with.
Returns
true iff the point in time represented by this MonoTime object is earlier then the point in time represented by the parameter.

◆ Earliest()

static const MonoTime& kudu::MonoTime::Earliest ( const MonoTime a,
const MonoTime b 
)
static

Select the earliest between the specified time points.

Deprecated:
Use use std::min() instead.
Parameters
[in]aThe first MonoTime object to select from.
[in]bThe second MonoTime object to select from.
Returns
The earliest (minimum) of the two monotimes.

◆ Equals()

bool kudu::MonoTime::Equals ( const MonoTime other) const

Check whether this object represents the same point in time as the other.

Parameters
[in]otherThe other MonoTime object to compare.
Returns
true iff the point in time represented by this MonoTime object is the same as the one represented by the other.

◆ GetDeltaSince()

MonoDelta kudu::MonoTime::GetDeltaSince ( const MonoTime rhs) const

Compute time interval between the point in time specified by this and the specified object.

Deprecated:
Use kudu::operator-(const MonoTime&, const MonoTime&) instead.
Parameters
[in]rhsThe object that corresponds to the left boundary of the time interval, where this object corresponds to the right boundary of the interval.
Returns
The resulting time interval represented as a MonoDelta object.

◆ Initialized()

bool kudu::MonoTime::Initialized ( ) const
Returns
true iff the object is initialized.

◆ Max()

static MonoTime kudu::MonoTime::Max ( )
static
Returns
MonoTime equal to farthest possible time into the future.

◆ Min()

static MonoTime kudu::MonoTime::Min ( )
static
Returns
MonoTime equal to farthest possible time into the past.

◆ Now()

static MonoTime kudu::MonoTime::Now ( )
static

Get current time in MonoTime representation.

Returns
Time specification for the moment of the method's invocation.

◆ operator+=()

MonoTime& kudu::MonoTime::operator+= ( const MonoDelta delta)

Add a delta to the point in time represented by the object.

Parameters
[in]deltaThe delta to add.
Returns
Reference to the modified object.

◆ operator-=()

MonoTime& kudu::MonoTime::operator-= ( const MonoDelta delta)

Substract a delta from the point in time represented by the object.

Parameters
[in]deltaThe delta to substract.
Returns
Reference to the modified object.

◆ ToString()

std::string kudu::MonoTime::ToString ( ) const
Returns
String representation of the object (in seconds).

◆ ToTimeSpec()

void kudu::MonoTime::ToTimeSpec ( struct timespec *  ts) const

Represent this point in time as a timespec structure, with nanosecond accuracy.

Parameters
[out]tsPlaceholder for the result value.

The documentation for this class was generated from the following file: