aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/exec_ctx.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/iomgr/exec_ctx.cc')
-rw-r--r--src/core/lib/iomgr/exec_ctx.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc
index 03c833ff07..5401a94dd3 100644
--- a/src/core/lib/iomgr/exec_ctx.cc
+++ b/src/core/lib/iomgr/exec_ctx.cc
@@ -53,21 +53,22 @@ static gpr_timespec g_start_time;
static gpr_atm timespec_to_atm_round_down(gpr_timespec ts) {
ts = gpr_time_sub(ts, g_start_time);
- double x =
- GPR_MS_PER_SEC * (double)ts.tv_sec + (double)ts.tv_nsec / GPR_NS_PER_MS;
+ double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
+ static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS;
if (x < 0) return 0;
if (x > GPR_ATM_MAX) return GPR_ATM_MAX;
- return (gpr_atm)x;
+ return static_cast<gpr_atm>(x);
}
static gpr_atm timespec_to_atm_round_up(gpr_timespec ts) {
ts = gpr_time_sub(ts, g_start_time);
- double x = GPR_MS_PER_SEC * (double)ts.tv_sec +
- (double)ts.tv_nsec / GPR_NS_PER_MS +
- (double)(GPR_NS_PER_SEC - 1) / (double)GPR_NS_PER_SEC;
+ double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
+ static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS +
+ static_cast<double>(GPR_NS_PER_SEC - 1) /
+ static_cast<double>(GPR_NS_PER_SEC);
if (x < 0) return 0;
if (x > GPR_ATM_MAX) return GPR_ATM_MAX;
- return (gpr_atm)x;
+ return static_cast<gpr_atm>(x);
}
gpr_timespec grpc_millis_to_timespec(grpc_millis millis,