-- assert fixes for thrift concurrency lib
Summary:
- cannot assume that assert.h is defined
Reviewed By: marc k
Test Plan: everything compiles
Notes:
- need to reflect these changes in libfacebook/fbthread
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665073 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index 06b4d18..de4d578 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -67,14 +67,16 @@
static const long long currentTime() {
#if defined(HAVE_CLOCK_GETTIME)
struct timespec now;
- assert(clock_gettime(CLOCK_REALTIME, &now) == 0);
+ int ret = clock_gettime(CLOCK_REALTIME, &now);
+ assert(ret);
return
(now.tv_sec * MS_PER_S) +
(now.tv_nsec / NS_PER_MS) +
(now.tv_nsec % NS_PER_MS >= 500000 ? 1 : 0) ;
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval now;
- assert(gettimeofday(&now, NULL) == 0);
+ int ret = gettimeofday(&now, NULL);
+ assert(ret);
return
(((long long)now.tv_sec) * MS_PER_S) +
(now.tv_usec / MS_PER_S) +