From 3bf466fb6c8cbbd4334d70be9c251feb71a7c78a Mon Sep 17 00:00:00 2001 From: ctiller Date: Fri, 19 Dec 2014 16:21:57 -0800 Subject: 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 ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=82551363 --- src/core/support/time.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/core/support/time.c') 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. */ -- cgit v1.2.3