CoreDX DDS Modern C++ API
Public Member Functions | Static Public Member Functions | Related Functions | List of all members
dds::core::Time Class Reference

Holds a point in time. More...

Public Member Functions

 Time ()
 Construct a Time instance initialized to zero.
 
 Time (int64_t sec, uint32_t nanosec=0)
 Construct a Time instance initialized the provided seconds + nanoseconds.
 
int64_t sec () const
 Access the integral seconds stored in this Time.
 
void sec (int64_t s)
 Set the integral seconds stored in this Time.
 
uint32_t nanosec () const
 Access the integral nano seconds stored in this Time.
 
void nanosec (uint32_t ns)
 Set the integral nano seconds stored in this Time.
 
int compare (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator> (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator>= (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator== (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator!= (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator<= (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
bool operator< (const Time &that) const
 Compare this Time instance to the provided Time instance. More...
 
Timeoperator+= (const Duration &a_ti)
 Adds the provided Duration to this time.
 
Timeoperator-= (const Duration &a_ti)
 Subtracts the provided Duration from this time.
 
int64_t to_millisecs () const
 Convert this Time to milliseconds.
 
int64_t to_microsecs () const
 Convert this Time to microseconds.
 
double to_secs () const
 Convert this Time to seconds.
 

Static Public Member Functions

static const Time invalid ()
 Construct a time instance that indicates an 'invalid' time. More...
 
static const Time from_microsecs (int64_t microseconds)
 Construct a Time instance from the provided microseconds value.
 
static const Time from_millisecs (int64_t milliseconds)
 Construct a Time instance from the provided milliseconds value.
 
static const Time from_secs (double seconds)
 Construct a Time instance from the provided seconds value.
 

Related Functions

(Note that these are not member functions.)

const dds::core::Time operator+ (const dds::core::Time &lhs, const dds::core::Duration &rhs)
 
const dds::core::Time operator+ (const dds::core::Duration &lhs, const dds::core::Time &rhs)
 
const dds::core::Time operator- (const dds::core::Time &lhs, const dds::core::Duration &rhs)
 

Detailed Description

Holds a point in time.

Member Function Documentation

◆ compare()

int dds::core::Time::compare ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
a negative value if this is less than that, zero if this is equal to that, and a positive value if this is greater than that.

◆ invalid()

static const Time dds::core::Time::invalid ( )
static

Construct a time instance that indicates an 'invalid' time.

◆ operator!=()

bool dds::core::Time::operator!= ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is not equal to that

◆ operator<()

bool dds::core::Time::operator< ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is less than that

◆ operator<=()

bool dds::core::Time::operator<= ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is less than or equal to that

◆ operator==()

bool dds::core::Time::operator== ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is equal to that

◆ operator>()

bool dds::core::Time::operator> ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is greater than that

◆ operator>=()

bool dds::core::Time::operator>= ( const Time that) const

Compare this Time instance to the provided Time instance.

Returns
true if this is greater than or equal to that

Friends And Related Function Documentation

◆ operator+() [1/2]

const dds::core::Time operator+ ( const dds::core::Time lhs,
const dds::core::Duration rhs 
)
related

Add the Time and Duration parameters together

Returns
The result of the addition in a Time instance.

◆ operator+() [2/2]

const dds::core::Time operator+ ( const dds::core::Duration lhs,
const dds::core::Time rhs 
)
related

Add the Time and Duration parameters together

Returns
The result of the addition in a Time instance.

◆ operator-()

const dds::core::Time operator- ( const dds::core::Time lhs,
const dds::core::Duration rhs 
)
related

Subtract the Duration from the Time

Returns
The result of the subtraction in a Time instance.

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.