reverted gpr_ time changes

pull/5270/head
David Garcia Quintas 9 years ago
parent 057a0a2033
commit ef6848fe5b
  1. 2
      include/grpc++/impl/codegen/core_codegen_interface.h
  2. 31
      include/grpc/impl/codegen/time.h
  3. 24
      src/core/support/time.c
  4. 5
      src/cpp/common/core_codegen.cc
  5. 2
      src/cpp/common/core_codegen.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;
};

@ -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

@ -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 */

@ -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();

@ -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,

Loading…
Cancel
Save