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

A representation of a time interval. More...

#include <monotime.h>

Public Member Functions

 MonoDelta ()
 
bool Initialized () const
 
bool LessThan (const MonoDelta &rhs) const
 
bool MoreThan (const MonoDelta &rhs) const
 
bool Equals (const MonoDelta &rhs) const
 
std::string ToString () const
 
void ToTimeVal (struct timeval *tv) const
 
void ToTimeSpec (struct timespec *ts) const
 
Converters into seconds representation (and ubiquitous SI prefixes).
double ToSeconds () const
 
int64_t ToMilliseconds () const
 
int64_t ToMicroseconds () const
 
int64_t ToNanoseconds () const
 
Syntactic sugar: increment/decrement operators for MonoDelta.
MonoDeltaoperator+= (const MonoDelta &delta)
 
MonoDeltaoperator-= (const MonoDelta &delta)
 

Static Public Member Functions

static void NanosToTimeSpec (int64_t nanos, struct timespec *ts)
 
Converters from seconds representation (and ubiquitous SI prefixes).
static MonoDelta FromSeconds (double seconds)
 
static MonoDelta FromMilliseconds (int64_t ms)
 
static MonoDelta FromMicroseconds (int64_t us)
 
static MonoDelta FromNanoseconds (int64_t ns)
 

Detailed Description

A representation of a time interval.

The MonoDelta class represents an elapsed duration of time – i.e. the delta between two MonoTime instances.

Constructor & Destructor Documentation

◆ MonoDelta()

kudu::MonoDelta::MonoDelta ( )

Build a MonoDelta object.

Note
A MonoDelta instance built with the this default constructor is "uninitialized" and may not be used for any operation.

Member Function Documentation

◆ Equals()

bool kudu::MonoDelta::Equals ( const MonoDelta rhs) const

Check whether this time interval has the same duration as the specified one.

Parameters
[in]rhsA time interval for comparison.
Returns
true iff this time interval has the same duration as the the specified one.

◆ FromMicroseconds()

static MonoDelta kudu::MonoDelta::FromMicroseconds ( int64_t  us)
static
Parameters
[in]usTime interval representation in seconds (with ubiquitous SI prefixes).
Returns
The resulting MonoDelta object initialized in accordance with the specified parameter.

◆ FromMilliseconds()

static MonoDelta kudu::MonoDelta::FromMilliseconds ( int64_t  ms)
static
Parameters
[in]msTime interval representation in seconds (with ubiquitous SI prefixes).
Returns
The resulting MonoDelta object initialized in accordance with the specified parameter.

◆ FromNanoseconds()

static MonoDelta kudu::MonoDelta::FromNanoseconds ( int64_t  ns)
static
Parameters
[in]nsTime interval representation in seconds (with ubiquitous SI prefixes).
Returns
The resulting MonoDelta object initialized in accordance with the specified parameter.

◆ FromSeconds()

static MonoDelta kudu::MonoDelta::FromSeconds ( double  seconds)
static
Parameters
[in]secondsTime interval representation in seconds (with ubiquitous SI prefixes).
Returns
The resulting MonoDelta object initialized in accordance with the specified parameter.

◆ Initialized()

bool kudu::MonoDelta::Initialized ( ) const
Returns
true iff this object is initialized.

◆ LessThan()

bool kudu::MonoDelta::LessThan ( const MonoDelta rhs) const

Check whether this time interval is shorter than the specified one.

Parameters
[in]rhsA time interval for comparison.
Returns
true iff this time interval is strictly shorter than the specified one.

◆ MoreThan()

bool kudu::MonoDelta::MoreThan ( const MonoDelta rhs) const

Check whether this time interval is longer than the specified one.

Parameters
[in]rhsA time interval for comparison.
Returns
true iff this time interval is strictly longer than the specified one.

◆ NanosToTimeSpec()

static void kudu::MonoDelta::NanosToTimeSpec ( int64_t  nanos,
struct timespec *  ts 
)
static

Convert a nanosecond value to a timespec.

Parameters
[in]nanosRepresentation of a relative point in time in nanoseconds.
[out]tsPlaceholder for the resulting timespec representation.

◆ operator+=()

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

Add a delta to current time interval.

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

◆ operator-=()

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

Substract a delta from current time interval.

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

◆ ToMicroseconds()

int64_t kudu::MonoDelta::ToMicroseconds ( ) const
Returns
Representation of the time interval in appropriate SI units.

◆ ToMilliseconds()

int64_t kudu::MonoDelta::ToMilliseconds ( ) const
Returns
Representation of the time interval in appropriate SI units.

◆ ToNanoseconds()

int64_t kudu::MonoDelta::ToNanoseconds ( ) const
Returns
Representation of the time interval in appropriate SI units.

◆ ToSeconds()

double kudu::MonoDelta::ToSeconds ( ) const
Returns
Representation of the time interval in appropriate SI units.

◆ ToString()

std::string kudu::MonoDelta::ToString ( ) const
Returns
String representation of this interval's duration (in seconds).

◆ ToTimeSpec()

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

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

Parameters
[out]tsPlaceholder for the result value.

◆ ToTimeVal()

void kudu::MonoDelta::ToTimeVal ( struct timeval *  tv) const

Represent this time interval as a timeval structure, with microsecond accuracy.

Parameters
[out]tvPlaceholder for the result value.

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