Present  0.9
 All Classes Files Functions Variables Typedefs Friends Macros Pages
TimeDelta Struct Reference

Class or struct representing a positive or negative delta of a number of nanoseconds, seconds, minutes, hours, days, or weeks. More...

Public Member Functions

int_delta nanoseconds () const
 Get the number of nanoseconds represented by a TimeDelta. More...
 
int_delta microseconds () const
 Get the number of microseconds represented by a TimeDelta. More...
 
double microseconds_decimal () const
 Get the number of microseconds represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta milliseconds () const
 Get the number of milliseconds represented by a TimeDelta. More...
 
double milliseconds_decimal () const
 Get the number of milliseconds represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta seconds () const
 Get the number of seconds represented by a TimeDelta. More...
 
double seconds_decimal () const
 Get the number of seconds represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta minutes () const
 Get the number of minutes represented by a TimeDelta. More...
 
double minutes_decimal () const
 Get the number of minutes represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta hours () const
 Get the number of hours represented by a TimeDelta. More...
 
double hours_decimal () const
 Get the number of hours represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta days () const
 Get the number of days represented by a TimeDelta. More...
 
double days_decimal () const
 Get the number of days represented by a TimeDelta, with a fractional part if necessary. More...
 
int_delta weeks () const
 Get the number of weeks represented by a TimeDelta. More...
 
double weeks_decimal () const
 Get the number of weeks represented by a TimeDelta, with a fractional part if necessary. More...
 
DayDelta to_DayDelta_truncated () const
 Convert a TimeDelta into a DayDelta, rounding towards zero if the TimeDelta does not represent an exact number of days. More...
 
DayDelta to_DayDelta_rounded () const
 Convert a TimeDelta into a DayDelta, rounding to the nearest day if the TimeDelta does not represent an exact number of days. More...
 
DayDelta to_DayDelta_abs_ceil () const
 Convert a TimeDelta into a DayDelta, rounding away from zero if the TimeDelta does not represent an exact number of days. More...
 
bool is_negative () const
 Determine whether a TimeDelta is negative. More...
 
void negate ()
 Negate a TimeDelta, making it negative if it was positive or positive if it was negative. More...
 
TimeDelta operator- () const
 Return the negated version of this TimeDelta. More...
 
TimeDeltaoperator*= (const long &scale_factor)
 Scale a TimeDelta by multiplying it by an integer scale factor. More...
 
TimeDeltaoperator*= (const double &scale_factor)
 Scale a TimeDelta by multiplying it by a floating point scale factor. More...
 
TimeDeltaoperator/= (const long &scale_factor)
 Scale a TimeDelta by dividing it by an integer scale factor. More...
 
TimeDeltaoperator/= (const double &scale_factor)
 Scale a TimeDelta by dividing it by a floating point scale factor. More...
 
TimeDeltaoperator+= (const TimeDelta &other)
 Add another TimeDelta to a TimeDelta. More...
 
TimeDeltaoperator+= (const DayDelta &other)
 Add a DayDelta to a TimeDelta. More...
 
TimeDeltaoperator-= (const TimeDelta &other)
 Subtract another TimeDelta from a TimeDelta. More...
 
TimeDeltaoperator-= (const DayDelta &other)
 Subtract a DayDelta from a TimeDelta. More...
 

Static Public Member Functions

static TimeDelta from_nanoseconds (int_delta nanoseconds)
 Create a new TimeDelta based on a positive or negative number of nanoseconds. More...
 
static TimeDelta from_microseconds (int_delta microseconds)
 Create a new TimeDelta based on a positive or negative number of microseconds. More...
 
static TimeDelta from_milliseconds (int_delta milliseconds)
 Create a new TimeDelta based on a positive or negative number of milliseconds. More...
 
static TimeDelta from_seconds (int_delta seconds)
 Create a new TimeDelta based on a positive or negative number of seconds. More...
 
static TimeDelta from_minutes (int_delta minutes)
 Create a new TimeDelta based on a positive or negative number of minutes. More...
 
static TimeDelta from_hours (int_delta hours)
 Create a new TimeDelta based on a positive or negative number of hours. More...
 
static TimeDelta from_days (int_delta days)
 Create a new TimeDelta based on a positive or negative number of days. More...
 
static TimeDelta from_weeks (int_delta weeks)
 Create a new TimeDelta based on a positive or negative number of weeks. More...
 
static TimeDelta zero ()
 Create a new TimeDelta initialized to zero time. More...
 
static short compare (const TimeDelta &lhs, const TimeDelta &rhs)
 Compare two TimeDelta instances. More...
 
static short compare (const TimeDelta &lhs, const DayDelta &rhs)
 Compare a TimeDelta to a DayDelta. More...
 
static short compare (const DayDelta &lhs, const TimeDelta &rhs)
 

Public Attributes

struct PresentTimeDeltaData data_
 

Friends

const TimeDelta operator* (const TimeDelta &delta, const long &scale_factor)
 
const TimeDelta operator* (const TimeDelta &delta, const double &scale_factor)
 
const TimeDelta operator/ (const TimeDelta &delta, const long &scale_factor)
 
const TimeDelta operator/ (const TimeDelta &delta, const double &scale_factor)
 
const TimeDelta operator+ (const TimeDelta &lhs, const TimeDelta &rhs)
 
const TimeDelta operator+ (const TimeDelta &lhs, const DayDelta &rhs)
 
const TimeDelta operator+ (const DayDelta &lhs, const TimeDelta &rhs)
 
const TimeDelta operator- (const TimeDelta &lhs, const TimeDelta &rhs)
 
const TimeDelta operator- (const TimeDelta &lhs, const DayDelta &rhs)
 
const TimeDelta operator- (const DayDelta &lhs, const TimeDelta &rhs)
 
bool operator== (const TimeDelta &lhs, const TimeDelta &rhs)
 Determine whether two TimeDelta instances are equal (lhs == rhs). More...
 
bool operator== (const TimeDelta &lhs, const DayDelta &rhs)
 Determine whether a TimeDelta is equal to a DayDelta (lhs == rhs). More...
 
bool operator!= (const TimeDelta &lhs, const TimeDelta &rhs)
 
bool operator!= (const TimeDelta &lhs, const DayDelta &rhs)
 
bool operator< (const TimeDelta &lhs, const TimeDelta &rhs)
 Determine whether a TimeDelta is less than another TimeDelta (lhs < rhs). More...
 
bool operator< (const TimeDelta &lhs, const DayDelta &rhs)
 Determine whether a TimeDelta is less than a DayDelta (lhs < rhs). More...
 
bool operator<= (const TimeDelta &lhs, const TimeDelta &rhs)
 Determine whether a TimeDelta is less than or equal to another TimeDelta (lhs <= rhs). More...
 
bool operator<= (const TimeDelta &lhs, const DayDelta &rhs)
 Determine whether a TimeDelta is less than or equal to a DayDelta (lhs <= rhs). More...
 
bool operator> (const TimeDelta &lhs, const TimeDelta &rhs)
 Determine whether a TimeDelta is greater than another TimeDelta (lhs > rhs). More...
 
bool operator> (const TimeDelta &lhs, const DayDelta &rhs)
 Determine whether a TimeDelta is greater than a DayDelta (lhs > rhs). More...
 
bool operator>= (const TimeDelta &lhs, const TimeDelta &rhs)
 Determine whether a TimeDelta is greater than or equal to another TimeDelta (lhs >= rhs). More...
 
bool operator>= (const TimeDelta &lhs, const DayDelta &rhs)
 Determine whether a TimeDelta is greater than or equal to a DayDelta (lhs >= rhs). More...
 

Detailed Description

Class or struct representing a positive or negative delta of a number of nanoseconds, seconds, minutes, hours, days, or weeks.

Member Function Documentation

static TimeDelta TimeDelta::from_nanoseconds ( int_delta  nanoseconds)
static

Create a new TimeDelta based on a positive or negative number of nanoseconds.

static TimeDelta TimeDelta::from_microseconds ( int_delta  microseconds)
static

Create a new TimeDelta based on a positive or negative number of microseconds.

static TimeDelta TimeDelta::from_milliseconds ( int_delta  milliseconds)
static

Create a new TimeDelta based on a positive or negative number of milliseconds.

static TimeDelta TimeDelta::from_seconds ( int_delta  seconds)
static

Create a new TimeDelta based on a positive or negative number of seconds.

static TimeDelta TimeDelta::from_minutes ( int_delta  minutes)
static

Create a new TimeDelta based on a positive or negative number of minutes.

static TimeDelta TimeDelta::from_hours ( int_delta  hours)
static

Create a new TimeDelta based on a positive or negative number of hours.

static TimeDelta TimeDelta::from_days ( int_delta  days)
static

Create a new TimeDelta based on a positive or negative number of days.

static TimeDelta TimeDelta::from_weeks ( int_delta  weeks)
static

Create a new TimeDelta based on a positive or negative number of weeks.

static TimeDelta TimeDelta::zero ( )
static

Create a new TimeDelta initialized to zero time.

int_delta TimeDelta::nanoseconds ( ) const

Get the number of nanoseconds represented by a TimeDelta.

int_delta TimeDelta::microseconds ( ) const

Get the number of microseconds represented by a TimeDelta.

If the TimeDelta does not represent an exact number of microseconds, the return value will be truncated.

double TimeDelta::microseconds_decimal ( ) const

Get the number of microseconds represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::milliseconds ( ) const

Get the number of milliseconds represented by a TimeDelta.

If the TimeDelta does not represent an exact number of milliseconds, the return value will be truncated.

double TimeDelta::milliseconds_decimal ( ) const

Get the number of milliseconds represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::seconds ( ) const

Get the number of seconds represented by a TimeDelta.

If the TimeDelta does not represent an exact number of seconds, the returned value will be truncated.

double TimeDelta::seconds_decimal ( ) const

Get the number of seconds represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::minutes ( ) const

Get the number of minutes represented by a TimeDelta.

If the TimeDelta does not represent an exact number of minutes, the returned value will be truncated.

double TimeDelta::minutes_decimal ( ) const

Get the number of minutes represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::hours ( ) const

Get the number of hours represented by a TimeDelta.

If the TimeDelta does not represent an exact number of hours, the returned value will be truncated.

double TimeDelta::hours_decimal ( ) const

Get the number of hours represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::days ( ) const

Get the number of days represented by a TimeDelta.

If the TimeDelta does not represent an exact number of days, the returned value will be truncated.

double TimeDelta::days_decimal ( ) const

Get the number of days represented by a TimeDelta, with a fractional part if necessary.

int_delta TimeDelta::weeks ( ) const

Get the number of weeks represented by a TimeDelta.

If the TimeDelta does not represent an exact number of weeks, the returned value will be truncated.

double TimeDelta::weeks_decimal ( ) const

Get the number of weeks represented by a TimeDelta, with a fractional part if necessary.

DayDelta TimeDelta::to_DayDelta_truncated ( ) const

Convert a TimeDelta into a DayDelta, rounding towards zero if the TimeDelta does not represent an exact number of days.

DayDelta TimeDelta::to_DayDelta_rounded ( ) const

Convert a TimeDelta into a DayDelta, rounding to the nearest day if the TimeDelta does not represent an exact number of days.

DayDelta TimeDelta::to_DayDelta_abs_ceil ( ) const

Convert a TimeDelta into a DayDelta, rounding away from zero if the TimeDelta does not represent an exact number of days.

bool TimeDelta::is_negative ( ) const

Determine whether a TimeDelta is negative.

void TimeDelta::negate ( )

Negate a TimeDelta, making it negative if it was positive or positive if it was negative.

TimeDelta TimeDelta::operator- ( ) const

Return the negated version of this TimeDelta.

See Also
TimeDelta::negate
TimeDelta& TimeDelta::operator*= ( const long &  scale_factor)

Scale a TimeDelta by multiplying it by an integer scale factor.

TimeDelta& TimeDelta::operator*= ( const double &  scale_factor)

Scale a TimeDelta by multiplying it by a floating point scale factor.

TimeDelta& TimeDelta::operator/= ( const long &  scale_factor)

Scale a TimeDelta by dividing it by an integer scale factor.

TimeDelta& TimeDelta::operator/= ( const double &  scale_factor)

Scale a TimeDelta by dividing it by a floating point scale factor.

TimeDelta& TimeDelta::operator+= ( const TimeDelta other)

Add another TimeDelta to a TimeDelta.

The second TimeDelta parameter is added to the first.

TimeDelta& TimeDelta::operator+= ( const DayDelta other)

Add a DayDelta to a TimeDelta.

The DayDelta parameter is added to the TimeDelta.

TimeDelta& TimeDelta::operator-= ( const TimeDelta other)

Subtract another TimeDelta from a TimeDelta.

The second TimeDelta parameter is subtracted from the first.

TimeDelta& TimeDelta::operator-= ( const DayDelta other)

Subtract a DayDelta from a TimeDelta.

The DayDelta parameter is subtracted from the TimeDelta.

static short TimeDelta::compare ( const TimeDelta lhs,
const TimeDelta rhs 
)
static

Compare two TimeDelta instances.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
static short TimeDelta::compare ( const TimeDelta lhs,
const DayDelta rhs 
)
static

Compare a TimeDelta to a DayDelta.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
static short TimeDelta::compare ( const DayDelta lhs,
const TimeDelta rhs 
)
static

Friends And Related Function Documentation

const TimeDelta operator* ( const TimeDelta delta,
const long &  scale_factor 
)
friend
const TimeDelta operator* ( const TimeDelta delta,
const double &  scale_factor 
)
friend
const TimeDelta operator/ ( const TimeDelta delta,
const long &  scale_factor 
)
friend
const TimeDelta operator/ ( const TimeDelta delta,
const double &  scale_factor 
)
friend
const TimeDelta operator+ ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend
const TimeDelta operator+ ( const TimeDelta lhs,
const DayDelta rhs 
)
friend
const TimeDelta operator+ ( const DayDelta lhs,
const TimeDelta rhs 
)
friend
const TimeDelta operator- ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend
const TimeDelta operator- ( const TimeDelta lhs,
const DayDelta rhs 
)
friend
const TimeDelta operator- ( const DayDelta lhs,
const TimeDelta rhs 
)
friend
bool operator== ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether two TimeDelta instances are equal (lhs == rhs).

bool operator== ( const TimeDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a TimeDelta is equal to a DayDelta (lhs == rhs).

bool operator!= ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend
bool operator!= ( const TimeDelta lhs,
const DayDelta rhs 
)
friend
bool operator< ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a TimeDelta is less than another TimeDelta (lhs < rhs).

bool operator< ( const TimeDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a TimeDelta is less than a DayDelta (lhs < rhs).

bool operator<= ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a TimeDelta is less than or equal to another TimeDelta (lhs <= rhs).

bool operator<= ( const TimeDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a TimeDelta is less than or equal to a DayDelta (lhs <= rhs).

bool operator> ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a TimeDelta is greater than another TimeDelta (lhs > rhs).

bool operator> ( const TimeDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a TimeDelta is greater than a DayDelta (lhs > rhs).

bool operator>= ( const TimeDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a TimeDelta is greater than or equal to another TimeDelta (lhs >= rhs).

bool operator>= ( const TimeDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a TimeDelta is greater than or equal to a DayDelta (lhs >= rhs).

Member Data Documentation

struct PresentTimeDeltaData TimeDelta::data_

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