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

Function ValidateTimestamp

internal/time.cc:105–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105absl::Status ValidateTimestamp(absl::Time timestamp) {
106 if (timestamp < MinTimestamp()) {
107 return absl::InvalidArgumentError(
108 absl::StrCat("Timestamp \"", RawFormatTimestamp(timestamp),
109 "\" below minimum allowed timestamp \"",
110 RawFormatTimestamp(MinTimestamp()), "\""));
111 }
112 if (timestamp > MaxTimestamp()) {
113 return absl::InvalidArgumentError(
114 absl::StrCat("Timestamp \"", RawFormatTimestamp(timestamp),
115 "\" above maximum allowed timestamp \"",
116 RawFormatTimestamp(MaxTimestamp()), "\""));
117 }
118 return absl::OkStatus();
119}
120
121absl::StatusOr<absl::Time> ParseTimestamp(absl::string_view input) {
122 absl::Time timestamp;

Callers 9

TimestampFromValueFunction · 0.85
ValueFromValueFunction · 0.85
ParseTimestampFunction · 0.85
FormatTimestampFunction · 0.85
EncodeTimestampToJsonFunction · 0.85
ValidateTimestampsFunction · 0.85
FromObjectFunction · 0.85
TimestampValueFunction · 0.85
SafeTimestampValueFunction · 0.85

Calls 3

MinTimestampFunction · 0.85
RawFormatTimestampFunction · 0.85
MaxTimestampFunction · 0.85

Tested by

no test coverage detected