MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ParseTimestamp

Function ParseTimestamp

internal/time.cc:121–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121absl::StatusOr<absl::Time> ParseTimestamp(absl::string_view input) {
122 absl::Time timestamp;
123 std::string err;
124 if (!absl::ParseTime(absl::RFC3339_full, input, absl::UTCTimeZone(),
125 &timestamp, &err)) {
126 return err.empty() ? absl::InvalidArgumentError(
127 "Failed to parse timestamp from string")
128 : absl::InvalidArgumentError(absl::StrCat(
129 "Failed to parse timestamp from string: ", err));
130 }
131 CEL_RETURN_IF_ERROR(ValidateTimestamp(timestamp));
132 return timestamp;
133}
134
135absl::StatusOr<std::string> FormatTimestamp(absl::Time timestamp) {
136 CEL_RETURN_IF_ERROR(ValidateTimestamp(timestamp));

Callers 1

TESTFunction · 0.85

Calls 2

ValidateTimestampFunction · 0.85
emptyMethod · 0.45

Tested by 1

TESTFunction · 0.68