aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support/time_posix.c
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2016-04-26 11:27:14 -0700
committerGravatar Sree Kuchibhotla <sreek@google.com>2016-04-26 11:27:14 -0700
commit30499760db987c67fe71839c52c24473a5365e0c (patch)
tree9b9965393a6346ee9b0b34032349925b366b9532 /src/core/lib/support/time_posix.c
parent0b9fdd8adc4b2d167e33a6d39e7ff4a46ef9a65c (diff)
parentc3d869ef5853c4cfad57b7d3694d5260eeb7ce75 (diff)
Merge branch 'master' into server_channel_affinity
Diffstat (limited to 'src/core/lib/support/time_posix.c')
-rw-r--r--src/core/lib/support/time_posix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/lib/support/time_posix.c b/src/core/lib/support/time_posix.c
index f5f62dadc6..11542072fe 100644
--- a/src/core/lib/support/time_posix.c
+++ b/src/core/lib/support/time_posix.c
@@ -78,7 +78,7 @@ static const clockid_t clockid_for_gpr_clock[] = {CLOCK_MONOTONIC,
void gpr_time_init(void) { gpr_precise_clock_init(); }
-gpr_timespec gpr_now(gpr_clock_type clock_type) {
+static gpr_timespec now_impl(gpr_clock_type clock_type) {
struct timespec now;
GPR_ASSERT(clock_type != GPR_TIMESPAN);
if (clock_type == GPR_CLOCK_PRECISE) {
@@ -114,7 +114,7 @@ void gpr_time_init(void) {
g_time_start = mach_absolute_time();
}
-gpr_timespec gpr_now(gpr_clock_type clock) {
+static gpr_timespec now_impl(gpr_clock_type clock) {
gpr_timespec now;
struct timeval now_tv;
double now_dbl;
@@ -142,6 +142,12 @@ gpr_timespec gpr_now(gpr_clock_type clock) {
}
#endif
+gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl;
+
+gpr_timespec gpr_now(gpr_clock_type clock_type) {
+ return gpr_now_impl(clock_type);
+}
+
void gpr_sleep_until(gpr_timespec until) {
gpr_timespec now;
gpr_timespec delta;