Parse the first length characters of an ISO 8601 string as a bsls::TimeInterval.

Synopsis

Declared in <bdlt_iso8601util.h>

static
int
parse(
    bsls::TimeInterval* result,
    char const* string,
    ssize_t length);

Description

Parse the specified initial length characters of the specified ISO 8601 string as a bsls::TimeInterval value, and load the value into the specified result. Return 0 on success, and a non‐zero value (with no effect) otherwise. string is assumed to be of the form: ` <Parsed Duration> ` See "Summary of Supported ISO 8601 Duration Representations" for a complete description of this format.

Exactly length characters are parsed; parsing will fail if a proper prefix of string matches the expected format, but the entire length characters do not. If an optional fractional second having more than nine digits is present in string, it is rounded to the nearest value in nanoseconds. The behavior is undefined unless `0 <= length`.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

result

receives the parsed bsls::TimeInterval

string

ISO 8601 text to parse

length

number of characters to parse

Created with MrDocs