absl::AbslParseFlag

Parses the command-line flag string representation text into a Time value. Time flags must be specified in a format that matches absl::RFC3339_full.

Synopsis

Declared in <absl/time/time.h>

bool
AbslParseFlag(
    std::string_view text,
    Time* t,
    std::string* error);

Description

For example:

--start_time=2016-01-02T03:04:05.678+08:00

Note: A UTC offset (or 'Z' indicating a zero-offset from UTC) is required.

Additionally, if you'd like to specify a time as a count of seconds/milliseconds/etc from the Unix epoch, use an absl::Duration flag and add that duration to absl::UnixEpoch() to get an absl::Time.

Return Value

true upon successful parsing.

Parameters

NameDescription
textThe flag string to parse.
tOutput parameter receiving the parsed time.
errorOutput parameter receiving an error message on failure.