BloombergLP::bdlt::DatetimeInterval

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

Synopsis

Declared in <bdlt_datetimeinterval.h>

class DatetimeInterval;

Member Functions

NameDescription
DatetimeInterval [constructor]Constructors
operator= Assign to this object the value of the specified rhs time interval, and return a reference providing modifiable access to this object.
addDays Add the specified number of days to this time interval.
addDaysIfValid Add the specified number of days if the result is valid.
addHours Add the specified number of hours to this time interval.
addHoursIfValid Add the specified number of hours if the result is valid.
addInterval Add the specified field values to this time interval.
addIntervalIfValid Add the specified field values to this interval if the result is valid.
addMicroseconds Add the specified number of microseconds to this time interval.
addMicrosecondsIfValid Add the specified number of microseconds if the result is valid.
addMilliseconds Add the specified number of milliseconds to this time interval.
addMillisecondsIfValid Add the specified number of milliseconds if the result is valid.
addMinutes Add the specified number of minutes to this time interval.
addMinutesIfValid Add the specified number of minutes if the result is valid.
addSeconds Add the specified number of seconds to this time interval.
addSecondsIfValid Add the specified number of seconds if the result is valid.
bdexStreamIn Assign to this object the value read from the specified input stream.
bdexStreamOut Write this object to the specified output stream using BDEX.
days Return the days field of this time interval.
fractionalDayInMicroseconds Return the sub-day portion of this interval in microseconds.
hours Return the hours field in the canonical representation of the value of this time interval. Note that the return value may be negative.
microseconds Return the microseconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.
milliseconds Return the milliseconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.
minutes Return the minutes field in the canonical representation of the value of this time interval. Note that the return value may be negative.
operator+= Add the specified rhs time interval to this object.
operator-= Subtract the specified rhs time interval from this object.
print Write this object to the specified output stream in a human-readable format.
printToBuffer Write a representation of this interval into the specified buffer.
seconds Return the seconds field in the canonical representation of the value of this time interval. Note that the return value may be negative.
setInterval Set this time interval to the specified field values.
setIntervalIfValid Set this time interval to the specified field values if valid.
setTotalDays Set the overall value of this object to indicate the specified number of days.
setTotalHours Set this interval to the specified total number of hours.
setTotalHoursIfValid Set this interval to the specified total hours if the result is valid.
setTotalMicroseconds Set this interval to the specified total number of microseconds.
setTotalMilliseconds Set this interval to the specified total number of milliseconds.
setTotalMillisecondsIfValid Set this interval to the specified total milliseconds if valid.
setTotalMinutes Set this interval to the specified total number of minutes.
setTotalMinutesIfValid Set this interval to the specified total minutes if valid.
setTotalSeconds Set this interval to the specified total number of seconds.
setTotalSecondsFromDouble Set this interval from a floating-point total of seconds.
setTotalSecondsFromDoubleIfValid Set this interval from floating-point seconds if the result is valid.
setTotalSecondsIfValid Set this interval to the specified total seconds if valid.
streamOut Format this datetime interval to the specified output stream, and return a reference to stream.
totalDays Return this time interval in integral days, rounded toward 0.
totalHours Return the value of this time interval in integral hours, rounded toward 0. Note that the return value may be negative.
totalMicroseconds Return this time interval as an integral number of microseconds.
totalMilliseconds Return the value of this time interval in integral milliseconds, rounded towards zero. Note that the return value may be negative.
totalMinutes Return the value of this time interval in integral minutes, rounded toward 0. Note that the return value may be negative.
totalSeconds Return the value of this time interval in integral seconds, rounded toward 0. Note that the return value may be negative.
totalSecondsAsDouble Return this time interval in seconds as a floating-point value.

Static Member Functions

NameDescription
isValid Return whether the given field values can form a valid time interval.
maxSupportedBdexVersion maxSupportedBdexVersion overloads
maxSupportedVersion Return the most current BDEX streaming version number supported by this class.

Static Data Members

NameDescription
k_MILLISECONDS_MAX The maximum interval that is representable by a DatetimeInterval, in milliseconds.
k_MILLISECONDS_MIN The minimum interval that is representable by a DatetimeInterval, in milliseconds.

Friends

NameDescription
BloombergLP::bdlt::hashAppendPass object to hashAlg for modular hashing.
BloombergLP::bdlt::operator>=Return true if the specified lhs interval is greater than or equal to the specified rhs interval, and false otherwise.
BloombergLP::bdlt::operator>Return true if the specified lhs interval is greater than the specified rhs interval, and false otherwise.
BloombergLP::bdlt::operator<=Return true if the specified lhs interval is less than or equal to the specified rhs interval, and false otherwise.
BloombergLP::bdlt::operator<Return true if the specified lhs interval is less than rhs.
BloombergLP::bdlt::operator!=Return true if the specified lhs and rhs intervals are not equal.
BloombergLP::bdlt::operator==Return true if the specified lhs and rhs intervals are equal.
BloombergLP::bdlt::operator-Return a DatetimeInterval object whose value is the negative of the specified time interval value. The behavior is undefined unless INT_MIN < value.days().

Non-Member Functions

NameDescription
operator+Return the sum of a datetime interval and a datetime.
operator+Return a Time value that is the sum of the specified lhs datetime interval and the specified rhs time.
operator+Return the sum of the specified lhs and rhs time intervals.
operator-Return a DatetimeInterval object initialized with the difference between the specified lhs and rhs time values.
operator-Return the interval between two datetimes.
operator-Return the difference between the specified lhs and rhs intervals.