BloombergLP::bdlt::DatetimeInterval::addIntervalIfValid

Add the specified field values to this interval if the result is valid.

Synopsis

Declared in <bdlt_datetimeinterval.h>

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);

Description

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.

Return Value

0 on success, and a non-zero value (with no effect) otherwise

Parameters

NameDescription
daysday count to add
hourshour count to add (optional)
minutesminute count to add (optional)
secondssecond count to add (optional)
millisecondsmillisecond count to add (optional)
microsecondsmicrosecond count to add (optional)