BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls::TimeInterval Class Reference

#include <bsls_timeinterval.h>

Public Member Functions

BSLS_KEYWORD_CONSTEXPR TimeInterval ()
 
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval (bsls::Types::Int64 seconds, int nanoseconds)
 
 TimeInterval (double seconds)
 
template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval (const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &duration, typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_IMPLICIT_CONVERSION_ENABLED, int >::type *=0)
 
template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval (const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &duration, typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_EXPLICIT_CONVERSION_ENABLED, int >::type *=0)
 
 TimeInterval (const TimeInterval &original)=default
 
 ~TimeInterval ()=default
 
TimeIntervaloperator= (const TimeInterval &rhs)=default
 
TimeIntervaloperator= (double rhs)
 
TimeIntervaloperator+= (const TimeInterval &rhs)
 
TimeIntervaloperator+= (double rhs)
 
TimeIntervaloperator-= (const TimeInterval &rhs)
 
TimeIntervaloperator-= (double rhs)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeIntervaladdDays (bsls::Types::Int64 days)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeIntervaladdHours (bsls::Types::Int64 hours)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeIntervaladdMinutes (bsls::Types::Int64 minutes)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeIntervaladdSeconds (bsls::Types::Int64 seconds)
 
TimeIntervaladdMilliseconds (bsls::Types::Int64 milliseconds)
 
TimeIntervaladdMicroseconds (bsls::Types::Int64 microseconds)
 
TimeIntervaladdNanoseconds (bsls::Types::Int64 nanoseconds)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalDays (bsls::Types::Int64 days)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalHours (bsls::Types::Int64 hours)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalMinutes (bsls::Types::Int64 minutes)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalSeconds (bsls::Types::Int64 seconds)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalMilliseconds (bsls::Types::Int64 milliseconds)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalMicroseconds (bsls::Types::Int64 microseconds)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setTotalNanoseconds (bsls::Types::Int64 nanoseconds)
 
TimeIntervaladdInterval (bsls::Types::Int64 seconds, int nanoseconds=0)
 
template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeIntervaladdDuration (const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &duration, typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_IMPLICIT_CONVERSION_ENABLED, int >::type *=0)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setInterval (bsls::Types::Int64 seconds, int nanoseconds=0)
 
BSLS_KEYWORD_CONSTEXPR_CPP14 void setIntervalRaw (bsls::Types::Int64 seconds, int nanoseconds=0)
 
template<class STREAM >
STREAM & bdexStreamIn (STREAM &stream, int version)
 
template<class DURATION_TYPE >
bool isInDurationRange (typename std::enable_if< TimeInterval_IsDuration< DURATION_TYPE >::value, int >::type *=0) const
 
BSLS_KEYWORD_CONSTEXPR int nanoseconds () const
 
BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 seconds () const
 
BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 totalDays () const
 
BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 totalHours () const
 
BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 totalMinutes () const
 
BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 totalSeconds () const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 totalMilliseconds () const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 totalMicroseconds () const
 
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 totalNanoseconds () const
 
template<class DURATION_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 std::enable_if< TimeInterval_IsDuration< DURATION_TYPE >::value &&!TimeInterval_RepTraits< typenameDURATION_TYPE::rep >::k_IS_FLOAT, DURATION_TYPE >::type asDuration () const
 
double totalSecondsAsDouble () const
 
template<class STREAM >
STREAM & bdexStreamOut (STREAM &stream, int version) const
 
std::ostream & print (std::ostream &stream, int level=0, int spacesPerLevel=4) const
 
template<class STREAM >
STREAM & streamOut (STREAM &stream) const
 

Static Public Member Functions

static BSLS_KEYWORD_CONSTEXPR bool isValid (bsls::Types::Int64 seconds, int nanoseconds)
 
template<class REP , class PERIOD >
static bool isValid (const std::chrono::duration< REP, PERIOD > &duration)
 
static int maxSupportedBdexVersion (int versionSelector)
 
static int maxSupportedBdexVersion ()
 
static int maxSupportedVersion ()
 

Detailed Description

Each instance of this value-semantic type represents a time interval with nanosecond resolution. In the "canonical representation" of a time interval, the seconds field may have any 64-bit signed integer value, with the nanoseconds field limited to the range [ -999,999,999..999,999,999 ], and with the additional constraint that the two fields are either both non-negative or both non-positive.

See bsls_timeinterval

Constructor & Destructor Documentation

◆ TimeInterval() [1/6]

BSLS_KEYWORD_CONSTEXPR bsls::TimeInterval::TimeInterval ( )
inline

Create a time interval having the value of 0 seconds and 0 nanoseconds.

◆ TimeInterval() [2/6]

BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::TimeInterval::TimeInterval ( bsls::Types::Int64  seconds,
int  nanoseconds 
)
inline

Create a time interval having the value given by the sum of the specified integral number of seconds and nanoseconds. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer (see isValid). Note that there is no restriction on the sign or magnitude of either argument except that they must not violate the method's preconditions.

◆ TimeInterval() [3/6]

bsls::TimeInterval::TimeInterval ( double  seconds)
explicit

Create a time interval having the value represented by the specified real number of seconds. The fractional part of seconds, if any, is rounded to the nearest whole number of nanoseconds. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer.

◆ TimeInterval() [4/6]

template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::TimeInterval::TimeInterval ( const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &  duration,
typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_IMPLICIT_CONVERSION_ENABLED, int >::type *  = 0 
)
inline

Create a time interval having the value represented by the specified duration. Only integer representations of duration are supported (i.e. REP_TYPE is integer). If the duration can be represented exactly by an integer nanoseconds this constructor will be implicit. Otherwise, the constructor will be explicit. The behavior is undefined unless the duration can be converted to a valid TimeInterval object, whose seconds field may have any 64-bit signed integer value and nanoseconds field limited to the range [ -999,999,999..999,999,999 ]. Note that the current implementation of the lossy conversions (e.g., fractions of a nanosecond) truncates the values towards zero, however this behavior may change without notice in the future, so do not rely on this.

◆ TimeInterval() [5/6]

template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::TimeInterval::TimeInterval ( const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &  duration,
typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_EXPLICIT_CONVERSION_ENABLED, int >::type *  = 0 
)
inlineexplicit

◆ TimeInterval() [6/6]

bsls::TimeInterval::TimeInterval ( const TimeInterval original)
default

◆ ~TimeInterval()

bsls::TimeInterval::~TimeInterval ( )
default

Member Function Documentation

◆ addDays()

BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval & bsls::TimeInterval::addDays ( bsls::Types::Int64  days)
inline

Add to this time interval the number of seconds represented by the specified integral number of days, and return a reference providing modifiable access to this object. The behavior is undefined unless the number of seconds in days, and the total number of seconds in the resulting time interval, can both be represented with 64-bit signed integers. Note that days may be negative.

◆ addDuration()

template<class REP_TYPE , class PERIOD_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval & bsls::TimeInterval::addDuration ( const std::chrono::duration< REP_TYPE, PERIOD_TYPE > &  duration,
typename std::enable_if< TimeInterval_DurationTraits< REP_TYPE, PERIOD_TYPE >::k_IMPLICIT_CONVERSION_ENABLED, int >::type *  = 0 
)
inline

Add to this time interval the specified duration. Return a reference providing modifiable access to this object. The behavior is undefined unless the duration can be converted to a valid TimeInterval object, whose seconds field may have any 64-bit signed integer value and nanoseconds field limited to the range [ -999,999,999..999,999,999 ]. Also the behavior is undefined unless the total number of seconds in the resulting time interval can be represented with 64-bit signed integer. Note that this operation is allowed only if representation type of the duration is not a floating point type and the duration itself can be exactly represented by an integer nanoseconds.

◆ addHours()

BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval & bsls::TimeInterval::addHours ( bsls::Types::Int64  hours)
inline

Add to this time interval the number of seconds represented by the specified integral number of hours, and return a reference providing modifiable access to this object. The behavior is undefined unless the number of seconds in hours, and the total number of seconds in the resulting time interval, can both be represented with 64-bit signed integers. Note that hours may be negative.

◆ addInterval()

TimeInterval & bsls::TimeInterval::addInterval ( bsls::Types::Int64  seconds,
int  nanoseconds = 0 
)

Add to this time interval the specified integral number of seconds, and the optionally specified integral number of nanoseconds. If unspecified, nanoseconds is 0. Return a reference providing modifiable access to this object. The behavior is undefined unless seconds() + seconds, and the total number of seconds in the resulting time interval, can both be represented with 64-bit signed integers.

◆ addMicroseconds()

TimeInterval & bsls::TimeInterval::addMicroseconds ( bsls::Types::Int64  microseconds)
inline

Add to this time interval the specified integral number of microseconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer. Note that microseconds may be negative.

◆ addMilliseconds()

TimeInterval & bsls::TimeInterval::addMilliseconds ( bsls::Types::Int64  milliseconds)
inline

Add to this time interval the specified integral number of milliseconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer. Note that milliseconds may be negative.

◆ addMinutes()

BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval & bsls::TimeInterval::addMinutes ( bsls::Types::Int64  minutes)
inline

Add to this time interval the number of seconds represented by the specified integral number of minutes, and return a reference providing modifiable access to this object. The behavior is undefined unless the number of seconds in minutes, and the total number of seconds in the resulting time interval, can both be represented with 64-bit signed integers. Note that minutes may be negative.

◆ addNanoseconds()

TimeInterval & bsls::TimeInterval::addNanoseconds ( bsls::Types::Int64  nanoseconds)
inline

Add to this time interval the specified integral number of nanoseconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer. Note that nanoseconds may be negative.

◆ addSeconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 TimeInterval & bsls::TimeInterval::addSeconds ( bsls::Types::Int64  seconds)
inline

Add to this time interval the specified integral number of seconds, and return a reference providing modifiable access to this object. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer. Note that seconds may be negative.

◆ asDuration()

template<class DURATION_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP14 std::enable_if< TimeInterval_IsDuration< DURATION_TYPE >::value &&!TimeInterval_RepTraits< typenameDURATION_TYPE::rep >::k_IS_FLOAT, DURATION_TYPE >::type bsls::TimeInterval::asDuration ( ) const
inline

Return the value of this time interval as a std::chrono::duration object. This function participates in overloading if DURATION_TYPE is actually an std::chrono::duration instance, and if it has not a floating point representation. The behavior is undefined unless the total number of nanoseconds can be represented using a DURATION_TYPE. Note that the return value may be negative.

◆ bdexStreamIn()

template<class STREAM >
STREAM & bsls::TimeInterval::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 & bsls::TimeInterval::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.

◆ isInDurationRange()

template<class DURATION_TYPE >
bool bsls::TimeInterval::isInDurationRange ( typename std::enable_if< TimeInterval_IsDuration< DURATION_TYPE >::value, int >::type *  = 0) const

Return true if the value of this time interval is within the valid range of the parameterized DURATION_TYPE, and false otherwise. Note that this function does not participate in overload resolution unless DURATION_TYPE is an instantiation of std::chrono::duration.

◆ isValid() [1/2]

BSLS_KEYWORD_CONSTEXPR bool bsls::TimeInterval::isValid ( bsls::Types::Int64  seconds,
int  nanoseconds 
)
inlinestatic

Return true if a TimeInterval object can be constructed from the specified seconds and nanoseconds, and false otherwise. A time interval can be constructed from seconds and nanoseconds if their sum results in a time interval whose total number of seconds can be represented with a 64-bit signed integer.

◆ isValid() [2/2]

template<class REP , class PERIOD >
bool bsls::TimeInterval::isValid ( const std::chrono::duration< REP, PERIOD > &  duration)
static

Return true if a TimeInterval object can be constructed from the specified duration, and false otherwise. A time interval can be constructed from duration if duration's value converted to seconds can be represented with a 64-bit signed integer.

◆ maxSupportedBdexVersion() [1/2]

int bsls::TimeInterval::maxSupportedBdexVersion ( )
inlinestatic
Deprecated:
Use maxSupportedBdexVersion(int) instead.

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

◆ maxSupportedBdexVersion() [2/2]

int bsls::TimeInterval::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 bsls::TimeInterval::maxSupportedVersion ( )
inlinestatic
Deprecated:
Use maxSupportedBdexVersion(int) instead.

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

◆ nanoseconds()

BSLS_KEYWORD_CONSTEXPR int bsls::TimeInterval::nanoseconds ( ) const
inline

Return the nanoseconds field in the canonical representation of the value of this time interval.

◆ operator+=() [1/2]

TimeInterval & bsls::TimeInterval::operator+= ( const TimeInterval 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 total number of seconds in the resulting time interval can be represented with a 64-bit signed integer.

◆ operator+=() [2/2]

TimeInterval & bsls::TimeInterval::operator+= ( double  rhs)
inline

Add to this time interval the value of the specified rhs real number of seconds, and return a reference providing modifiable access to this object. The fractional part of rhs, if any, is rounded to the nearest whole number of nanoseconds before being added to this object. The behavior is undefined unless rhs can be converted to a valid TimeInterval object, and the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer.

◆ operator-=() [1/2]

TimeInterval & bsls::TimeInterval::operator-= ( const TimeInterval 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 LLONG_MIN != rhs.seconds(), and the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer.

◆ operator-=() [2/2]

TimeInterval & bsls::TimeInterval::operator-= ( double  rhs)
inline

Subtract from this time interval the value of the specified rhs real number of seconds, and return a reference providing modifiable access to this object. The fractional part of rhs, if any, is rounded to the nearest whole number of nanoseconds before being subtracted from this object. The behavior is undefined unless rhs can be converted to a valid TimeInterval object whose seconds field is greater than LLONG_MIN, and the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer.

◆ operator=() [1/2]

TimeInterval & bsls::TimeInterval::operator= ( const TimeInterval rhs)
default

◆ operator=() [2/2]

TimeInterval & bsls::TimeInterval::operator= ( double  rhs)
inline

Assign to this time interval the value of the specified rhs real number of seconds, and return a reference providing modifiable access to this object. The fractional part of rhs, if any, is rounded to the nearest whole number of nanoseconds. The behavior is undefined unless rhs can be converted to a valid TimeInterval object.

◆ print()

std::ostream & bsls::TimeInterval::print ( std::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 providing modifiable access 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.

◆ seconds()

BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 bsls::TimeInterval::seconds ( ) const
inline

Return the seconds field in the canonical representation of the value of this time interval.

◆ setInterval()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setInterval ( bsls::Types::Int64  seconds,
int  nanoseconds = 0 
)
inline

Set this time interval to have the value given by the sum of the specified integral number of seconds, and the optionally specified integral number of nanoseconds. If unspecified, nanoseconds is 0. The behavior is undefined unless the total number of seconds in the resulting time interval can be represented with a 64-bit signed integer (see isValid). Note that there is no restriction on the sign or magnitude of either argument except that they must not violate the method's preconditions.

◆ setIntervalRaw()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setIntervalRaw ( bsls::Types::Int64  seconds,
int  nanoseconds = 0 
)
inline

Set this time interval to have the value given by the sum of the specified integral number of seconds, and the optionally specified integral number of nanoseconds, where seconds and nanoseconds form a canonical representation of a time interval (see {Representation}). If unspecified, nanoseconds is 0. The behavior is undefined unless -999,999,999 <= nanoseconds <= +999,999,999 and seconds and nanoseconds are either both non-negative or both non-positive. Note that this function provides a subset of the defined behavior of setInterval chosen to minimize runtime performance cost.

◆ setTotalDays()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalDays ( bsls::Types::Int64  days)
inline

Set the overall value of this object to indicate the specified integral number of days. The behavior is undefined unless the number of seconds in days can be represented with a 64-bit signed integer. Note that days may be negative.

◆ setTotalHours()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalHours ( bsls::Types::Int64  hours)
inline

Set the overall value of this object to indicate the specified integral number of hours. The behavior is undefined unless the number of seconds in hours can be represented with a 64-bit signed integer. Note that hours may be negative.

◆ setTotalMicroseconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalMicroseconds ( bsls::Types::Int64  microseconds)
inline

Set the overall value of this object to indicate the specified integral number of microseconds. Note that microseconds may be negative.

◆ setTotalMilliseconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalMilliseconds ( bsls::Types::Int64  milliseconds)
inline

Set the overall value of this object to indicate the specified integral number of milliseconds. Note that milliseconds may be negative.

◆ setTotalMinutes()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalMinutes ( bsls::Types::Int64  minutes)
inline

Set the overall value of this object to indicate the specified integral number of minutes. The behavior is undefined unless the number of seconds in minutes can be represented with a 64-bit signed integer. Note that minutes may be negative.

◆ setTotalNanoseconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalNanoseconds ( bsls::Types::Int64  nanoseconds)
inline

Set the overall value of this object to indicate the specified integral number of nanoseconds. Note that nanoseconds may be negative.

◆ setTotalSeconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 void bsls::TimeInterval::setTotalSeconds ( bsls::Types::Int64  seconds)
inline

Set the overall value of this object to indicate the specified integral number of seconds. Note that seconds may be negative.

◆ streamOut()

template<class STREAM >
STREAM & bsls::TimeInterval::streamOut ( STREAM &  stream) const
inline
Deprecated:
Use print instead.

Format this time to the specified output stream, and return a reference to the modifiable stream.

◆ totalDays()

BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 bsls::TimeInterval::totalDays ( ) const
inline

Return the value of this time interval as an integral number of days, rounded towards zero. Note that the return value may be negative.

◆ totalHours()

BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 bsls::TimeInterval::totalHours ( ) const
inline

Return the value of this time interval as an integral number of hours, rounded towards zero. Note that the return value may be negative.

◆ totalMicroseconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 bsls::TimeInterval::totalMicroseconds ( ) const
inline

Return the value of this time interval as an integral number of microseconds, rounded towards zero. 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_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 bsls::TimeInterval::totalMilliseconds ( ) const
inline

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

◆ totalMinutes()

BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 bsls::TimeInterval::totalMinutes ( ) const
inline

Return the value of this time interval as an integral number of minutes, rounded towards zero. Note that the return value may be negative.

◆ totalNanoseconds()

BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 bsls::TimeInterval::totalNanoseconds ( ) const
inline

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

◆ totalSeconds()

BSLS_KEYWORD_CONSTEXPR bsls::Types::Int64 bsls::TimeInterval::totalSeconds ( ) const
inline

Return the value of this time interval as an integral number of seconds, rounded towards zero. Note that the return value may be negative. Also note that this method returns the same value as seconds.

◆ totalSecondsAsDouble()

double bsls::TimeInterval::totalSecondsAsDouble ( ) const
inline

Return the value of this time interval as a real number of seconds. Note that the return value may be negative and may have a fractional part (representing the nanosecond field of this object). Also note that the conversion from the internal representation to a double may lose precision.


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