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).
Returns
Representation of the time interval in appropriate SI units.
double ToSeconds () const
 
int64_t ToMilliseconds () const
 
int64_t ToMicroseconds () const
 
int64_t ToNanoseconds () const
 

Static Public Member Functions

static void NanosToTimeSpec (int64_t nanos, struct timespec *ts)
 
Converters from seconds representation (and ubiquitous SI prefixes).
Parameters
[in]seconds/ms/us/nsTime interval representation in seconds (with ubiquitous SI prefixes).
Returns
The resulting MonoDelta object initialized in accordance with the specified parameter.
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

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

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.
bool kudu::MonoDelta::Initialized ( ) const
Returns
true iff this object is initialized.
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.
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.
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.
std::string kudu::MonoDelta::ToString ( ) const
Returns
String representation of this interval's duration (in seconds).
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.
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: