| 84 | } |
| 85 | |
| 86 | absl::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 | |
| 94 | absl::StatusOr<std::string> EncodeTimeToString(absl::Time time) { |
| 95 | google::protobuf::Timestamp t; |