BloombergLP::bdlt::Time

Value-semantic type representing the time of day to microsecond resolution.

Synopsis

Declared in <bdlt_time.h>

class Time;

Description

This class implements a value-semantic type that represents the time of day to a resolution of one microsecond. Each object of this (almost) simply constrained attribute class always represents a valid time value to a resolution of one microsecond. The valid range for times is 00:00:00.000000 through 23:59:59.999999, except that 24:00:00.000000 represents the default-constructed value. The value 24:00:00.000000 behaves, in most cases, as if it were the value 00:00:00.000000; however, for all relational comparison operators, 24:00:00.000000 is not a valid argument and, therefore, would result in undefined behavior. Each add operation on a Time object returns the (signed) number of times that the 23:59:59.999999 - 00:00:00.000000 boundary was crossed while performing the operation. Attempting to construct a Time with any attribute outside its valid range (or with an hour attribute value of 24 and any other attribute non-zero) has undefined behavior.

Member Functions

NameDescription
Time [constructor]Constructors
operator= Assign to this time object the value of the specified rhs object, and return a reference providing modifiable access to this object.
addHours Increase this time by hours; return midnight-boundary crossings.
addInterval Increase this time by interval; return midnight-boundary crossings.
addMicroseconds Increase this time by microseconds; return midnight-boundary crossings.
addMilliseconds Increase this time by milliseconds; return midnight-boundary crossings.
addMinutes Increase this time by minutes; return midnight-boundary crossings.
addSeconds Increase this time by seconds; return midnight-boundary crossings.
addTime Add the specified signed time fields; return midnight-boundary crossings.
bdexStreamIn Assign to this object the value read from the specified input stream.
bdexStreamOut Write this object to the specified output stream using BDEX.
getTime Load the time-of-day attributes of this object into the given addresses.
hour Return the value of the hour attribute of this time object.
microsecond Return the value of the microsecond attribute of this time object.
millisecond Return the value of the millisecond attribute of this time object.
minute Return the value of the minute attribute of this time object.
operator+= Add to this time object the value of the specified rhs datetime interval, and return a reference providing modifiable access to this object.
operator-= Subtract from this time object the value of the specified rhs datetime interval, and return a reference providing modifiable access to this object.
print Write this time to the specified output stream in a human-readable form.
printToBuffer Write a textual representation of this time into result.
second Return the value of the second attribute of this time object.
setHour Set the hour attribute of this time object.
setHourIfValid Set the hour attribute if it is in range; otherwise do nothing.
setMicrosecond Set the microsecond attribute of this time object.
setMicrosecondIfValid Set the microsecond attribute if it is in range; otherwise do nothing.
setMillisecond Set the millisecond attribute of this time object.
setMillisecondIfValid Set the millisecond attribute if it is in range; otherwise do nothing.
setMinute Set the minute attribute of this time object.
setMinuteIfValid Set the minute attribute if it is in range; otherwise do nothing.
setSecond Set the second attribute of this time object.
setSecondIfValid Set the second attribute if it is in range; otherwise do nothing.
setTime Set this time from the specified time-of-day fields.
setTimeIfValid Set this time from fields if they form a valid value; otherwise do nothing.
streamOut Format this time to the specified output stream, and return a reference to the modifiable stream.
validateAndSetTime Set this time from fields if they form a valid value; otherwise do nothing.

Static Member Functions

NameDescription
isValid Return true if the specified fields form a valid Time value.
maxSupportedBdexVersion maxSupportedBdexVersion overloads
maxSupportedVersion Return the most current BDEX streaming version number supported by this class.

Friends

NameDescription
BloombergLP::bdlt::hashAppendInvoke the specified hashAlg on the specified Time object.
BloombergLP::bdlt::operator>Return true if lhs is later than rhs.
BloombergLP::bdlt::operator>=Return true if lhs is later than or equal to rhs.
BloombergLP::bdlt::operator<=Return true if lhs is earlier than or equal to rhs.
BloombergLP::bdlt::operator<Return true if lhs is earlier than rhs.
BloombergLP::bdlt::operator!=Return true if the two time objects do not have the same value.
BloombergLP::bdlt::operator==Return true if the two time objects have the same value.
BloombergLP::bdlt::operator-Return a DatetimeInterval object initialized with the difference between the specified lhs and rhs time values.

Non-Member Functions

NameDescription
operator+Return a Time value that is the sum of the specified lhs time and the specified rhs datetime interval.
operator+Return a Time value that is the sum of the specified lhs datetime interval and the specified rhs time.
operator-Return a Time value that is the difference between the specified lhs time and the specified rhs datetime interval.
operator<Return true if time lhs is less than compactable transition rhs.