BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlt::DatetimeInterval Class Reference

#include <bdlt_datetimeinterval.h>

Public Member Functions

 DatetimeInterval ()
 Create a time interval object having the value 0.
 
 DatetimeInterval (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
 DatetimeInterval (const DatetimeInterval &original)
 
 ~DatetimeInterval ()=default
 
DatetimeIntervaloperator= (const DatetimeInterval &rhs)
 
DatetimeIntervaloperator+= (const DatetimeInterval &rhs)
 
DatetimeIntervaloperator-= (const DatetimeInterval &rhs)
 
void setInterval (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
int setIntervalIfValid (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
void setTotalDays (int days)
 
void setTotalHours (bsls::Types::Int64 hours)
 
int setTotalHoursIfValid (bsls::Types::Int64 hours)
 
void setTotalMinutes (bsls::Types::Int64 minutes)
 
int setTotalMinutesIfValid (bsls::Types::Int64 minutes)
 
void setTotalSeconds (bsls::Types::Int64 seconds)
 
int setTotalSecondsIfValid (bsls::Types::Int64 seconds)
 
void setTotalSecondsFromDouble (double seconds)
 
int setTotalSecondsFromDoubleIfValid (double seconds)
 
void setTotalMilliseconds (bsls::Types::Int64 milliseconds)
 
int setTotalMillisecondsIfValid (bsls::Types::Int64 milliseconds)
 
void setTotalMicroseconds (bsls::Types::Int64 microseconds)
 
DatetimeIntervaladdInterval (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
int addIntervalIfValid (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
DatetimeIntervaladdDays (int days)
 
int addDaysIfValid (int days)
 
DatetimeIntervaladdHours (bsls::Types::Int64 hours)
 
int addHoursIfValid (bsls::Types::Int64 hours)
 
DatetimeIntervaladdMinutes (bsls::Types::Int64 minutes)
 
int addMinutesIfValid (bsls::Types::Int64 minutes)
 
DatetimeIntervaladdSeconds (bsls::Types::Int64 seconds)
 
int addSecondsIfValid (bsls::Types::Int64 seconds)
 
DatetimeIntervaladdMilliseconds (bsls::Types::Int64 milliseconds)
 
int addMillisecondsIfValid (bsls::Types::Int64 milliseconds)
 
DatetimeIntervaladdMicroseconds (bsls::Types::Int64 microseconds)
 
int addMicrosecondsIfValid (bsls::Types::Int64 microseconds)
 
template<class STREAM >
STREAM & bdexStreamIn (STREAM &stream, int version)
 
int days () const
 
bsls::Types::Int64 fractionalDayInMicroseconds () const
 
int hours () const
 
int minutes () const
 
int seconds () const
 
int milliseconds () const
 
int microseconds () const
 
int printToBuffer (char *result, int numBytes, int fractionalSecondPrecision=6) const
 
int totalDays () const
 
bsls::Types::Int64 totalHours () const
 
bsls::Types::Int64 totalMinutes () const
 
bsls::Types::Int64 totalSeconds () const
 
double totalSecondsAsDouble () const
 
bsls::Types::Int64 totalMilliseconds () const
 
bsls::Types::Int64 totalMicroseconds () const
 
template<class STREAM >
STREAM & bdexStreamOut (STREAM &stream, int version) const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 
bsl::ostream & streamOut (bsl::ostream &stream) const
 

Static Public Member Functions

static bool isValid (int days, bsls::Types::Int64 hours=0, bsls::Types::Int64 minutes=0, bsls::Types::Int64 seconds=0, bsls::Types::Int64 milliseconds=0, bsls::Types::Int64 microseconds=0)
 
static int maxSupportedBdexVersion (int versionSelector)
 
static int maxSupportedBdexVersion ()
 
static int maxSupportedVersion ()
 

Static Public Attributes

static const bsls::Types::Int64 k_MILLISECONDS_MAX = 185542587187199999LL
 
static const bsls::Types::Int64 k_MILLISECONDS_MIN
 

Friends

DatetimeInterval operator- (const DatetimeInterval &)
 
bool operator== (const DatetimeInterval &, const DatetimeInterval &)
 
bool operator!= (const DatetimeInterval &, const DatetimeInterval &)
 
bool operator< (const DatetimeInterval &, const DatetimeInterval &)
 
bool operator<= (const DatetimeInterval &, const DatetimeInterval &)
 
bool operator> (const DatetimeInterval &, const DatetimeInterval &)
 
bool operator>= (const DatetimeInterval &, const DatetimeInterval &)
 
template<class HASHALG >
void hashAppend (HASHALG &, const DatetimeInterval &)
 

Detailed Description

Each object of this class represents a (signed) time interval with microsecond resolution. See {The Representation of a Time Interval} for details.

See bdlt_datetimeinterval

Constructor & Destructor Documentation

◆ DatetimeInterval() [1/3]

bdlt::DatetimeInterval::DatetimeInterval ( )
inline

◆ DatetimeInterval() [2/3]

bdlt::DatetimeInterval::DatetimeInterval ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)
inlineexplicit

Create a time interval object having the value given by the specified days, and the optionally specified hours, minutes, seconds, milliseconds, and microseconds. Unspecified arguments default to 0. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer). Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ DatetimeInterval() [3/3]

bdlt::DatetimeInterval::DatetimeInterval ( const DatetimeInterval original)
inline

Create a time interval object having the value of the specified original time interval.

◆ ~DatetimeInterval()

bdlt::DatetimeInterval::~DatetimeInterval ( )
default

Member Function Documentation

◆ addDays()

DatetimeInterval & bdlt::DatetimeInterval::addDays ( int  days)
inline

Add to this time interval the specified number of days, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addDaysIfValid()

int bdlt::DatetimeInterval::addDaysIfValid ( int  days)
inline

Add to this time interval the specified number of days. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ addHours()

DatetimeInterval & bdlt::DatetimeInterval::addHours ( bsls::Types::Int64  hours)
inline

Add to this time interval the specified number of hours, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addHoursIfValid()

int bdlt::DatetimeInterval::addHoursIfValid ( bsls::Types::Int64  hours)
inline

Add to this time interval the specified number of hours. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ addInterval()

DatetimeInterval & bdlt::DatetimeInterval::addInterval ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)

Add to this time interval the specified number of days, and the optionally specified number of hours, minutes, seconds, milliseconds, and microseconds, and return a reference providing modifiable access to this object. Unspecified arguments default to 0. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer). Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ addIntervalIfValid()

int bdlt::DatetimeInterval::addIntervalIfValid ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)

Add to this time interval the specified number of days, and the optionally specified number of hours, minutes, seconds, milliseconds, and microseconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise. Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ addMicroseconds()

DatetimeInterval & bdlt::DatetimeInterval::addMicroseconds ( bsls::Types::Int64  microseconds)
inline

Add to this time interval the specified number of microseconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addMicrosecondsIfValid()

int bdlt::DatetimeInterval::addMicrosecondsIfValid ( bsls::Types::Int64  microseconds)
inline

Add to this time interval the specified number of microseconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ addMilliseconds()

DatetimeInterval & bdlt::DatetimeInterval::addMilliseconds ( bsls::Types::Int64  milliseconds)
inline

Add to this time interval the specified number of milliseconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addMillisecondsIfValid()

int bdlt::DatetimeInterval::addMillisecondsIfValid ( bsls::Types::Int64  milliseconds)
inline

Add to this time interval the specified number of milliseconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ addMinutes()

DatetimeInterval & bdlt::DatetimeInterval::addMinutes ( bsls::Types::Int64  minutes)
inline

Add to this time interval the specified number of minutes, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addMinutesIfValid()

int bdlt::DatetimeInterval::addMinutesIfValid ( bsls::Types::Int64  minutes)
inline

Add to this time interval the specified number of minutes. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ addSeconds()

DatetimeInterval & bdlt::DatetimeInterval::addSeconds ( bsls::Types::Int64  seconds)
inline

Add to this time interval the specified number of seconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ addSecondsIfValid()

int bdlt::DatetimeInterval::addSecondsIfValid ( bsls::Types::Int64  seconds)
inline

Add to this time interval the specified number of seconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ bdexStreamIn()

template<class STREAM >
STREAM & bdlt::DatetimeInterval::bdexStreamIn ( STREAM &  stream,
int  version 
)

Assign to this object the value read from the specified input stream using the specified version format, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, this object is unaltered and stream is invalidated, but otherwise unmodified. If version is supported but stream becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ bdexStreamOut()

template<class STREAM >
STREAM & bdlt::DatetimeInterval::bdexStreamOut ( STREAM &  stream,
int  version 
) const

Write the value of this object, using the specified version format, to the specified output stream, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, stream is invalidated, but otherwise unmodified. Note that version is not written to stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ days()

int bdlt::DatetimeInterval::days ( ) const
inline

Return the days field in the canonical representation of the value of this time interval. Note that the return value may be negative. Also note that the return value is the same as that returned by totalDays.

◆ fractionalDayInMicroseconds()

bsls::Types::Int64 bdlt::DatetimeInterval::fractionalDayInMicroseconds ( ) const
inline

Return the value of this time interval as an integral number of microseconds modulo the number of microseconds in a day. Note that the return value may be negative.

◆ hours()

int bdlt::DatetimeInterval::hours ( ) const
inline

Return the hours field in the canonical representation of the value of this time interval. Note that the return value may be negative.

◆ isValid()

static bool bdlt::DatetimeInterval::isValid ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)
static

Return true if a time interval object having the value given by the specified days, and the optionally specified hours, minutes, seconds, milliseconds, and microseconds can be represented as a DatetimeInterval and false otherwise. Unspecified arguments default to 0. The resulting time interval value is valid if the days field does not overflow a 32-bit integer. Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ maxSupportedBdexVersion() [1/2]

int bdlt::DatetimeInterval::maxSupportedBdexVersion ( )
inlinestatic
Deprecated:
Use maxSupportedBdexVersion(int) instead.

Return the most current BDEX streaming version number supported by this class.

◆ maxSupportedBdexVersion() [2/2]

int bdlt::DatetimeInterval::maxSupportedBdexVersion ( int  versionSelector)
inlinestatic

Return the maximum valid BDEX format version, as indicated by the specified versionSelector, to be passed to the bdexStreamOut method. Note that it is highly recommended that versionSelector be formatted as "YYYYMMDD", a date representation. Also note that versionSelector should be a compile-time-chosen value that selects a format version supported by both externalizer and unexternalizer. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ maxSupportedVersion()

int bdlt::DatetimeInterval::maxSupportedVersion ( )
inlinestatic
Deprecated:
Use maxSupportedBdexVersion(int) instead.

Return the most current BDEX streaming version number supported by this class.

◆ microseconds()

int bdlt::DatetimeInterval::microseconds ( ) const
inline

Return the microseconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.

◆ milliseconds()

int bdlt::DatetimeInterval::milliseconds ( ) const
inline

Return the milliseconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.

◆ minutes()

int bdlt::DatetimeInterval::minutes ( ) const
inline

Return the minutes field in the canonical representation of the value of this time interval. Note that the return value may be negative.

◆ operator+=()

DatetimeInterval & bdlt::DatetimeInterval::operator+= ( const DatetimeInterval rhs)
inline

Add to this time interval the value of the specified rhs time interval, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ operator-=()

DatetimeInterval & bdlt::DatetimeInterval::operator-= ( const DatetimeInterval rhs)
inline

Subtract from this time interval the value of the specified rhs time interval, and return a reference providing modifiable access to this object. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ operator=()

DatetimeInterval & bdlt::DatetimeInterval::operator= ( const DatetimeInterval rhs)
inline

Assign to this object the value of the specified rhs time interval, and return a reference providing modifiable access to this object.

◆ print()

bsl::ostream & bdlt::DatetimeInterval::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.

◆ printToBuffer()

int bdlt::DatetimeInterval::printToBuffer ( char *  result,
int  numBytes,
int  fractionalSecondPrecision = 6 
) const

Efficiently write to the specified result buffer no more than the specified numBytes of a representation of the value of this object. Optionally specify fractionalSecondPrecision digits to indicate how many fractional second digits to output. If fractionalSecondPrecision is not specified then 6 fractional second digits will be output (3 digits for milliseconds and 3 digits for microseconds). Return the number of characters (not including the null character) that would have been written if the limit due to numBytes were not imposed. result is null-terminated unless numBytes is 0. The behavior is undefined unless 0 <= numBytes, 0 <= fractionalSecondPrecision <= 6, and result refers to at least numBytes contiguous bytes. Note that the return value is greater than or equal to numBytes if the output representation was truncated to avoid result overrun.

◆ seconds()

int bdlt::DatetimeInterval::seconds ( ) const
inline

Return the seconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.

◆ setInterval()

void bdlt::DatetimeInterval::setInterval ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)

Set the time interval represented by this object to the value given by the specified days, and the optionally specified hours, minutes, seconds, milliseconds, and microseconds. Unspecified arguments default to 0. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer). Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ setIntervalIfValid()

int bdlt::DatetimeInterval::setIntervalIfValid ( int  days,
bsls::Types::Int64  hours = 0,
bsls::Types::Int64  minutes = 0,
bsls::Types::Int64  seconds = 0,
bsls::Types::Int64  milliseconds = 0,
bsls::Types::Int64  microseconds = 0 
)

Set the time interval represented by this object to the value given by the specified days, and the optionally specified hours, minutes, seconds, milliseconds, and microseconds. Unspecified arguments default to 0. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise. Note that the arguments may be supplied using a mixture of positive, negative, and 0 values.

◆ setTotalDays()

void bdlt::DatetimeInterval::setTotalDays ( int  days)
inline

Set the overall value of this object to indicate the specified number of days.

◆ setTotalHours()

void bdlt::DatetimeInterval::setTotalHours ( bsls::Types::Int64  hours)
inline

Set the overall value of this object to indicate the specified number of hours. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ setTotalHoursIfValid()

int bdlt::DatetimeInterval::setTotalHoursIfValid ( bsls::Types::Int64  hours)
inline

Set the overall value of this object to indicate the specified number of hours. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ setTotalMicroseconds()

void bdlt::DatetimeInterval::setTotalMicroseconds ( bsls::Types::Int64  microseconds)
inline

Set the overall value of this object to indicate the specified number of microseconds. Note that there is no setTotalMicrosecondsIfValid because no value of microseconds can cause the number of days to overflow.

◆ setTotalMilliseconds()

void bdlt::DatetimeInterval::setTotalMilliseconds ( bsls::Types::Int64  milliseconds)
inline

Set the overall value of this object to indicate the specified number of milliseconds. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ setTotalMillisecondsIfValid()

int bdlt::DatetimeInterval::setTotalMillisecondsIfValid ( bsls::Types::Int64  milliseconds)
inline

Set the overall value of this object to indicate the specified number of milliseconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ setTotalMinutes()

void bdlt::DatetimeInterval::setTotalMinutes ( bsls::Types::Int64  minutes)
inline

Set the overall value of this object to indicate the specified number of minutes. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ setTotalMinutesIfValid()

int bdlt::DatetimeInterval::setTotalMinutesIfValid ( bsls::Types::Int64  minutes)
inline

Set the overall value of this object to indicate the specified number of minutes. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ setTotalSeconds()

void bdlt::DatetimeInterval::setTotalSeconds ( bsls::Types::Int64  seconds)
inline

Set the overall value of this object to indicate the specified number of seconds. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ setTotalSecondsFromDouble()

void bdlt::DatetimeInterval::setTotalSecondsFromDouble ( double  seconds)

Set the overall value of this object to indicate the specified number of seconds. The fractional part of seconds, if any, is rounded to the nearest whole number of microseconds. The behavior is undefined unless the resulting time interval value is valid (i.e., the days field must not overflow a 32-bit integer).

◆ setTotalSecondsFromDoubleIfValid()

int bdlt::DatetimeInterval::setTotalSecondsFromDoubleIfValid ( double  seconds)

Set the overall value of this object to indicate the specified number of seconds. The fractional part of seconds, if any, is rounded to the nearest whole number of microseconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ setTotalSecondsIfValid()

int bdlt::DatetimeInterval::setTotalSecondsIfValid ( bsls::Types::Int64  seconds)
inline

Set the overall value of this object to indicate the specified number of seconds. Return 0 if the resulting time interval value is valid (i.e., the days field must not overflow an int) and a non-zero value (with no effect) otherwise.

◆ streamOut()

bsl::ostream & bdlt::DatetimeInterval::streamOut ( bsl::ostream &  stream) const
Deprecated:
use operator<< or print instead.

Format this datetime interval to the specified output stream, and return a reference to stream.

◆ totalDays()

int bdlt::DatetimeInterval::totalDays ( ) const
inline

Return the value of this time interval in integral days, rounded toward 0. Note that the return value may be negative. Also note that the return value is the same as that returned by days.

◆ totalHours()

bsls::Types::Int64 bdlt::DatetimeInterval::totalHours ( ) const
inline

Return the value of this time interval in integral hours, rounded toward 0. Note that the return value may be negative.

◆ totalMicroseconds()

bsls::Types::Int64 bdlt::DatetimeInterval::totalMicroseconds ( ) const
inline

Return the value of this time interval as an integral number of microseconds. The behavior is undefined unless the number of microseconds can be represented with a 64-bit signed integer. Note that the return value may be negative.

◆ totalMilliseconds()

bsls::Types::Int64 bdlt::DatetimeInterval::totalMilliseconds ( ) const
inline

Return the value of this time interval in integral milliseconds, rounded towards zero. Note that the return value may be negative.

◆ totalMinutes()

bsls::Types::Int64 bdlt::DatetimeInterval::totalMinutes ( ) const
inline

Return the value of this time interval in integral minutes, rounded toward 0. Note that the return value may be negative.

◆ totalSeconds()

bsls::Types::Int64 bdlt::DatetimeInterval::totalSeconds ( ) const
inline

Return the value of this time interval in integral seconds, rounded toward 0. Note that the return value may be negative.

◆ totalSecondsAsDouble()

double bdlt::DatetimeInterval::totalSecondsAsDouble ( ) const
inline

Return the value of this time interval in seconds as a double, potentially with a fractional part. Note that the return value may be negative. Also note that the conversion from the internal representation to double may lose precision.

Friends And Related Symbol Documentation

◆ hashAppend

template<class HASHALG >
void hashAppend ( HASHALG &  ,
const DatetimeInterval  
)
friend

Pass the specified object to the specified hashAlg. This function integrates with the bslh modular hashing system and effectively provides a bsl::hash specialization for DatetimeInterval.

◆ operator!=

bool operator!= ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

Return true if the specified lhs and rhs time intervals do not have the same value, and false otherwise. Two time intervals do not have the same value if any of the corresponding values of their days, hours, minutes, seconds, milliseconds, or microseconds fields is not the same.

◆ operator-

DatetimeInterval operator- ( const DatetimeInterval )
friend

Return a DatetimeInterval object whose value is the negative of the specified time interval value. The behavior is undefined unless INT_MIN < value.days().

◆ operator<

bool operator< ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

Return true if the nominal relation between the specified lhs and rhs time interval values holds, and false otherwise. lhs is less than rhs if the following expression evaluates to true:

lhs.days() < rhs.days()
|| (lhs.days() == rhs.days() && lhs.fractionalDayInMicroseconds()
< rhs.fractionalDayInMicroseconds())

The other relationships are defined similarly.

◆ operator<=

bool operator<= ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

◆ operator==

bool operator== ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

Return true if the specified lhs and rhs time intervals have the same value, and false otherwise. Two time intervals have the same value if all of the corresponding values of their days, hours, minutes, seconds, milliseconds, and microseconds fields are the same.

◆ operator>

bool operator> ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

◆ operator>=

bool operator>= ( const DatetimeInterval ,
const DatetimeInterval  
)
friend

Member Data Documentation

◆ k_MILLISECONDS_MAX

const bsls::Types::Int64 bdlt::DatetimeInterval::k_MILLISECONDS_MAX = 185542587187199999LL
static

The maximum interval that is representable by a DatetimeInterval, in milliseconds.

◆ k_MILLISECONDS_MIN

const bsls::Types::Int64 bdlt::DatetimeInterval::k_MILLISECONDS_MIN
static
Initial value:
=
static const bsls::Types::Int64 k_MILLISECONDS_MAX
Definition bdlt_datetimeinterval.h:253
static const bsls::Types::Int64 k_MILLISECONDS_PER_DAY
Definition bdlt_timeunitratio.h:249

The minimum interval that is representable by a DatetimeInterval, in milliseconds.


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