| 120 | } |
| 121 | |
| 122 | CelValue BetweenToD(Arena* arena, const google::protobuf::Message* time_of_day, |
| 123 | const google::protobuf::Message* start, const google::protobuf::Message* stop) { |
| 124 | bool is_between; |
| 125 | const google::type::TimeOfDay* time_of_day_tod = |
| 126 | google::protobuf::DynamicCastMessage<const google::type::TimeOfDay>(time_of_day); |
| 127 | const google::type::TimeOfDay* start_tod = |
| 128 | google::protobuf::DynamicCastMessage<const google::type::TimeOfDay>(start); |
| 129 | const google::type::TimeOfDay* stop_tod = |
| 130 | google::protobuf::DynamicCastMessage<const google::type::TimeOfDay>(stop); |
| 131 | |
| 132 | if ((time_of_day_tod == nullptr) || (start_tod == nullptr) || |
| 133 | (stop_tod == nullptr)) { |
| 134 | return CreateErrorValue(arena, "Message type downcast failed", |
| 135 | absl::StatusCode::kInvalidArgument); |
| 136 | } |
| 137 | // resolution for TimeOfDay in this function is 1 second |
| 138 | int start_time = ToSeconds(start_tod); |
| 139 | int stop_time = ToSeconds(stop_tod); |
| 140 | int tod_time = ToSeconds(time_of_day_tod); |
| 141 | |
| 142 | is_between = (tod_time >= start_time) && (tod_time < stop_time); |
| 143 | return CelValue::CreateBool(is_between); |
| 144 | } |
| 145 | |
| 146 | CelValue BetweenToDStr(Arena* arena, const google::protobuf::Message* time_of_day, |
| 147 | absl::string_view start, absl::string_view stop) { |
no test coverage detected