From ef6848fe5b98e607b376c3f3b235ff393ef0e59b Mon Sep 17 00:00:00 2001
From: David Garcia Quintas <dgq@google.com>
Date: Tue, 8 Mar 2016 16:05:30 -0800
Subject: [PATCH] reverted gpr_ time changes

---
 .../impl/codegen/core_codegen_interface.h     |  2 ++
 include/grpc/impl/codegen/time.h              | 31 +++----------------
 src/core/support/time.c                       | 24 ++++++++++++++
 src/cpp/common/core_codegen.cc                |  5 +++
 src/cpp/common/core_codegen.h                 |  2 ++
 5 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h
index a27c1f8057..8a5c74df6e 100644
--- a/include/grpc++/impl/codegen/core_codegen_interface.h
+++ b/include/grpc++/impl/codegen/core_codegen_interface.h
@@ -74,6 +74,8 @@ class CoreCodegenInterface {
   virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;
   virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0;
 
+  virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0;
+
   virtual void assert_fail(const char* failed_assertion) = 0;
 };
 
diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h
index 9776dabc11..c22bedfe77 100644
--- a/include/grpc/impl/codegen/time.h
+++ b/include/grpc/impl/codegen/time.h
@@ -69,33 +69,10 @@ typedef struct gpr_timespec {
 } gpr_timespec;
 
 /* Time constants. */
-/* The zero time interval. */
-GPRAPI static inline gpr_timespec gpr_time_0(gpr_clock_type type) {
-  gpr_timespec out;
-  out.tv_sec = 0;
-  out.tv_nsec = 0;
-  out.clock_type = type;
-  return out;
-}
-
-/* The far future */
-GPRAPI static inline gpr_timespec gpr_inf_future(gpr_clock_type type) {
-  gpr_timespec out;
-  out.tv_sec = INT64_MAX;
-  out.tv_nsec = 0;
-  out.clock_type = type;
-  return out;
-}
-
-/* The far past. */
-GPRAPI static inline gpr_timespec gpr_inf_past(gpr_clock_type type) {
-  gpr_timespec out;
-  out.tv_sec = INT64_MIN;
-  out.tv_nsec = 0;
-  out.clock_type = type;
-  return out;
-}
-
+GPRAPI gpr_timespec
+gpr_time_0(gpr_clock_type type); /* The zero time interval. */
+GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */
+GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type);   /* The far past. */
 
 #define GPR_MS_PER_SEC 1000
 #define GPR_US_PER_SEC 1000000
diff --git a/src/core/support/time.c b/src/core/support/time.c
index fec3c7a2c5..423d12ffc0 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -56,6 +56,30 @@ gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b) {
   return gpr_time_cmp(a, b) > 0 ? a : b;
 }
 
+gpr_timespec gpr_time_0(gpr_clock_type type) {
+  gpr_timespec out;
+  out.tv_sec = 0;
+  out.tv_nsec = 0;
+  out.clock_type = type;
+  return out;
+}
+
+gpr_timespec gpr_inf_future(gpr_clock_type type) {
+  gpr_timespec out;
+  out.tv_sec = INT64_MAX;
+  out.tv_nsec = 0;
+  out.clock_type = type;
+  return out;
+}
+
+gpr_timespec gpr_inf_past(gpr_clock_type type) {
+  gpr_timespec out;
+  out.tv_sec = INT64_MIN;
+  out.tv_nsec = 0;
+  out.clock_type = type;
+  return out;
+}
+
 /* TODO(ctiller): consider merging _nanos, _micros, _millis into a single
    function for maintainability. Similarly for _seconds, _minutes, and _hours */
 
diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc
index 2c1c11c7a4..9b8ff5d30c 100644
--- a/src/cpp/common/core_codegen.cc
+++ b/src/cpp/common/core_codegen.cc
@@ -200,6 +200,11 @@ void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) {
   ::grpc_metadata_array_destroy(array);
 }
 
+
+gpr_timespec CoreCodegen::gpr_inf_future(gpr_clock_type type) {
+  return ::gpr_inf_future(type);
+}
+
 void CoreCodegen::assert_fail(const char* failed_assertion) {
   gpr_log(GPR_ERROR, "assertion failed: %s", failed_assertion);
   abort();
diff --git a/src/cpp/common/core_codegen.h b/src/cpp/common/core_codegen.h
index b591209427..e0e26a8573 100644
--- a/src/cpp/common/core_codegen.h
+++ b/src/cpp/common/core_codegen.h
@@ -57,6 +57,8 @@ class CoreCodegen : public CoreCodegenInterface {
 
   void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
 
+  void gpr_inf_future(gpr_clock_type type) override;
+
   void assert_fail(const char* failed_assertion) override;
 
   Status SerializeProto(const grpc::protobuf::Message& msg,
-- 
GitLab