Skip to content
Snippets Groups Projects
Commit ef6848fe authored by David Garcia Quintas's avatar David Garcia Quintas
Browse files

reverted gpr_ time changes

parent 057a0a20
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,8 @@ class CoreCodegenInterface { ...@@ -74,6 +74,8 @@ class CoreCodegenInterface {
virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0; virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;
virtual void grpc_metadata_array_destroy(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; virtual void assert_fail(const char* failed_assertion) = 0;
}; };
......
...@@ -69,33 +69,10 @@ typedef struct gpr_timespec { ...@@ -69,33 +69,10 @@ typedef struct gpr_timespec {
} gpr_timespec; } gpr_timespec;
/* Time constants. */ /* Time constants. */
/* The zero time interval. */ GPRAPI gpr_timespec
GPRAPI static inline gpr_timespec gpr_time_0(gpr_clock_type type) { gpr_time_0(gpr_clock_type type); /* The zero time interval. */
gpr_timespec out; GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */
out.tv_sec = 0; GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */
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;
}
#define GPR_MS_PER_SEC 1000 #define GPR_MS_PER_SEC 1000
#define GPR_US_PER_SEC 1000000 #define GPR_US_PER_SEC 1000000
......
...@@ -56,6 +56,30 @@ gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b) { ...@@ -56,6 +56,30 @@ gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b) {
return gpr_time_cmp(a, b) > 0 ? a : 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 /* TODO(ctiller): consider merging _nanos, _micros, _millis into a single
function for maintainability. Similarly for _seconds, _minutes, and _hours */ function for maintainability. Similarly for _seconds, _minutes, and _hours */
......
...@@ -200,6 +200,11 @@ void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) { ...@@ -200,6 +200,11 @@ void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) {
::grpc_metadata_array_destroy(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) { void CoreCodegen::assert_fail(const char* failed_assertion) {
gpr_log(GPR_ERROR, "assertion failed: %s", failed_assertion); gpr_log(GPR_ERROR, "assertion failed: %s", failed_assertion);
abort(); abort();
......
...@@ -57,6 +57,8 @@ class CoreCodegen : public CoreCodegenInterface { ...@@ -57,6 +57,8 @@ class CoreCodegen : public CoreCodegenInterface {
void grpc_metadata_array_destroy(grpc_metadata_array* array) override; 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; void assert_fail(const char* failed_assertion) override;
Status SerializeProto(const grpc::protobuf::Message& msg, Status SerializeProto(const grpc::protobuf::Message& msg,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment