diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2017-10-17 20:13:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 20:13:43 +0200 |
commit | c698bd3fb3f87a6724e30194f7e573d9844beee8 (patch) | |
tree | ed84963343af7a4076b863188e22292ad0a3c64a | |
parent | 4345ea686465b8048ddabeac5470a319c6db6188 (diff) | |
parent | ce9bd53910199fe945461e0115b5314ef69b4f4e (diff) |
Merge pull request #13036 from jtattermusch/fix_time_from_millis
Fix grpc_millis_to_timespec on 32bit
-rw-r--r-- | src/core/lib/iomgr/exec_ctx.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index 3d17afcb8f..0394a00f3e 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -152,6 +152,15 @@ void grpc_exec_ctx_invalidate_now(grpc_exec_ctx *exec_ctx) { gpr_timespec grpc_millis_to_timespec(grpc_millis millis, gpr_clock_type clock_type) { + // special-case infinities as grpc_millis can be 32bit on some platforms + // while gpr_time_from_millis always takes an int64_t. + if (millis == GRPC_MILLIS_INF_FUTURE) { + return gpr_inf_future(clock_type); + } + if (millis == GRPC_MILLIS_INF_PAST) { + return gpr_inf_past(clock_type); + } + if (clock_type == GPR_TIMESPAN) { return gpr_time_from_millis(millis, GPR_TIMESPAN); } |