BloombergLP::bdlt::Datetime::addMicrosecondsIfValid

Add microseconds if the result remains a valid datetime.

Synopsis

Declared in <bdlt_datetime.h>

int
addMicrosecondsIfValid(bsls::Types::Int64 microseconds);

Description

Add the specified number of microseconds to the value of this object, adjusting the "date" part of the object accordingly, if the resulting value is in the valid range for a Datetime object. If 24 == hour() on entry, set the hour attribute to 0 before performing the addition. Return 0 on success, and a non-zero value (with no effect) otherwise. Note that microseconds may be positive, negative, or 0.

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
microsecondsnumber of microseconds to add (may be negative)