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

Function EncodeTime

internal/proto_time_encoding.cc:86–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86absl::Status EncodeTime(absl::Time time, google::protobuf::Timestamp* proto) {
87 CEL_RETURN_IF_ERROR(Validate(time));
88 const int64_t s = absl::ToUnixSeconds(time);
89 proto->set_seconds(s);
90 proto->set_nanos((time - absl::FromUnixSeconds(s)) / absl::Nanoseconds(1));
91 return absl::OkStatus();
92}
93
94absl::StatusOr<std::string> EncodeTimeToString(absl::Time time) {
95 google::protobuf::Timestamp t;

Callers 9

ExportAsProtoValueFunction · 0.85
CelValueToValueFunction · 0.85
TEST_FFunction · 0.85
AnyFromValueFunction · 0.85
TEST_FFunction · 0.85
EncodeTimeToStringFunction · 0.85
TESTFunction · 0.85
ToExprValueFunction · 0.85
ConstantToProtoFunction · 0.85

Calls 1

ValidateFunction · 0.85

Tested by 3

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TESTFunction · 0.68