BloombergLP::bdlt::DatetimeInterval::isValid

Return whether the given field values can form a valid time interval.

Synopsis

Declared in <bdlt_datetimeinterval.h>

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

Description

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.

Return Value

true if the field values form a valid interval, and false otherwise

Parameters

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