kudu::MonoTime Class Reference

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

#include <monotime.h>

List of all members.

Public Member Functions

 MonoTime ()
bool Initialized () const
MonoDelta GetDeltaSince (const MonoTime &rhs) const
void AddDelta (const MonoDelta &delta)
bool ComesBefore (const MonoTime &rhs) const
std::string ToString () const
bool Equals (const MonoTime &other) const
Syntactic sugar: increment/decrement operators for MonoTime.

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

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


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
static const int64_t kNanosecondsPerMillisecond = 1000000L
static const int64_t kNanosecondsPerMicrosecond = 1000L
static const int64_t kMicrosecondsPerSecond = 1000000L

Friends

class MonoDelta

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

kudu::MonoTime::MonoTime (  ) 

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


Member Function Documentation

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

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

Parameters:
[in] delta The time interval to add.
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] rhs The 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.
static const MonoTime& kudu::MonoTime::Earliest ( const MonoTime a,
const MonoTime b 
) [static]

Select the earliest between the specified time points.

Parameters:
[in] a The first MonoTime object to select from.
[in] b The second MonoTime object to select from.
Returns:
The earliest (minimum) of the two monotimes.
bool kudu::MonoTime::Equals ( const MonoTime other  )  const

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

Parameters:
[in] other The 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.
MonoDelta kudu::MonoTime::GetDeltaSince ( const MonoTime rhs  )  const

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

Parameters:
[in] rhs The 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.
bool kudu::MonoTime::Initialized (  )  const
Returns:
true iff the object is initialized.
static MonoTime kudu::MonoTime::Max (  )  [static]
Returns:
MonoTime equal to farthest possible time into the future.
static MonoTime kudu::MonoTime::Min (  )  [static]
Returns:
MonoTime equal to farthest possible time into the past.
static MonoTime kudu::MonoTime::Now (  )  [static]

Get current time in MonoTime representation.

Returns:
Time specification for the moment of the method's invocation.
MonoTime& kudu::MonoTime::operator-= ( const MonoDelta delta  ) 

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

Parameters:
[in] delta The delta to substract.
Returns:
Reference to the modified object.
std::string kudu::MonoTime::ToString (  )  const
Returns:
String representation of the object (in seconds).

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines