1 // Copyright 2022 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #include <grpc/support/port_platform.h>
15
16 #include "src/core/lib/event_engine/utils.h"
17
18 #include <stdint.h>
19
20 #include <algorithm>
21
22 #include "absl/strings/str_cat.h"
23
24 #include <grpc/event_engine/event_engine.h>
25
26 #include "src/core/lib/gprpp/time.h"
27
28 namespace grpc_event_engine {
29 namespace experimental {
30
HandleToStringInternal(uintptr_t a,uintptr_t b)31 std::string HandleToStringInternal(uintptr_t a, uintptr_t b) {
32 return absl::StrCat("{", a, ",", b, "}");
33 }
34
ToTimestamp(grpc_core::Timestamp now,EventEngine::Duration delta)35 grpc_core::Timestamp ToTimestamp(grpc_core::Timestamp now,
36 EventEngine::Duration delta) {
37 return now +
38 std::max(grpc_core::Duration::Milliseconds(1),
39 grpc_core::Duration::NanosecondsRoundUp(delta.count())) +
40 grpc_core::Duration::Milliseconds(1);
41 }
42
43 } // namespace experimental
44 } // namespace grpc_event_engine
45