aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support/time.c
diff options
context:
space:
mode:
authorGravatar ctiller <ctiller@google.com>2014-12-19 16:21:57 -0800
committerGravatar Jan Tattermusch <jtattermusch@google.com>2014-12-29 17:05:35 -0800
commit3bf466fb6c8cbbd4334d70be9c251feb71a7c78a (patch)
treeed26d5d417f67245175a9ad4883aa9c22691a04d /src/core/support/time.c
parent1a809c0ebbf77aedf7f6322ef7d6373962c80264 (diff)
Port [] alarm management to GRPC.
This change implements a platform independent alarm manager in alarm.c. It's integrated with iomgr, and some tests are cleaned up. The alarm implementation itself is a fairly direct port of LazyAlarmList from eventmanager. SpinLock has been replaced for now with gpr_mu, and other atomic operations have been dropped (again, for now). A majority of tests have been ported. Change on 2014/12/19 by ctiller <ctiller@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=82551363
Diffstat (limited to 'src/core/support/time.c')
-rw-r--r--src/core/support/time.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/support/time.c b/src/core/support/time.c
index 1d8765f8cc..712bdf441c 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -47,6 +47,14 @@ int gpr_time_cmp(gpr_timespec a, gpr_timespec b) {
return cmp;
}
+gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b) {
+ return gpr_time_cmp(a, b) < 0 ? a : b;
+}
+
+gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b) {
+ return gpr_time_cmp(a, b) > 0 ? a : b;
+}
+
/* There's no standard TIME_T_MIN and TIME_T_MAX, so we construct them. The
following assumes that signed types are two's-complement and that bytes are
8 bits. */