aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support/time_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/support/time_posix.c')
-rw-r--r--src/core/lib/support/time_posix.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/lib/support/time_posix.c b/src/core/lib/support/time_posix.c
index f5f62dadc6..cc0aa2b476 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) {
@@ -95,6 +95,12 @@ gpr_timespec gpr_now(gpr_clock_type clock_type) {
return gpr_from_timespec(now, clock_type);
}
}
+
+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);
+}
#else
/* For some reason Apple's OSes haven't implemented clock_gettime. */