Thrift: standardize coding style
Summary: Standardize indentation, spacing, #defines etc.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664784 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index df37471..724b69a 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -1,5 +1,5 @@
-#if !defined(_concurrency_Util_h_)
-#define _concurrency_Util_h_ 1
+#ifndef _THRIFT_CONCURRENCY_UTIL_H_
+#define _THRIFT_CONCURRENCY_UTIL_H_ 1
#include <config.h>
@@ -13,68 +13,71 @@
namespace facebook { namespace thrift { namespace concurrency {
-/** Utility methods
-
- This class contains basic utility methods for converting time formats, and other common platform-dependent concurrency operations.
- It should not be included in API headers for other concurrency library headers, since it will, by definition, pull in all sorts of
- horrid platform dependent crap. Rather it should be inluded directly in concurrency library implementation source.
-
- @author marc
- @version $Id:$ */
-
+/**
+ * Utility methods
+ *
+ * This class contains basic utility methods for converting time formats,
+ * and other common platform-dependent concurrency operations.
+ * It should not be included in API headers for other concurrency library
+ * headers, since it will, by definition, pull in all sorts of horrid
+ * platform dependent crap. Rather it should be inluded directly in
+ * concurrency library implementation source.
+ *
+ * @author marc
+ * @version $Id:$
+ */
class Util {
static const long long NS_PER_S = 1000000000LL;
-
static const long long MS_PER_S = 1000LL;
-
static const long long NS_PER_MS = 1000000LL;
public:
- /** Converts timespec to milliseconds
-
- @param struct timespec& result
- @param time or duration in milliseconds */
-
+ /**
+ * Converts timespec to milliseconds
+ *
+ * @param struct timespec& result
+ * @param time or duration in milliseconds
+ */
static void toTimespec(struct timespec& result, long long value) {
-
- result.tv_sec = value / MS_PER_S; // ms to s
-
+ result.tv_sec = value / MS_PER_S; // ms to s
result.tv_nsec = (value % MS_PER_S) * NS_PER_MS; // ms to ns
}
- /** Converts timespec to milliseconds */
-
+ /**
+ * Converts timespec to milliseconds
+ */
static const void toMilliseconds(long long& result, const struct timespec& value) {
-
- result = (value.tv_sec * MS_PER_S) + (value.tv_nsec / NS_PER_MS) + (value.tv_nsec % NS_PER_MS >= 500000 ? 1 : 0) ;
+ result =
+ (value.tv_sec * MS_PER_S) +
+ (value.tv_nsec / NS_PER_MS) +
+ (value.tv_nsec % NS_PER_MS >= 500000 ? 1 : 0);
}
- /** Get current time as milliseconds from epoch */
-
+ /**
+ * Get current time as milliseconds from epoch
+ */
static const long long currentTime() {
-
#if defined(HAVE_CLOCK_GETTIME)
-
struct timespec now;
-
assert(clock_gettime(CLOCK_REALTIME, &now) == 0);
-
- return (now.tv_sec * MS_PER_S) + (now.tv_nsec / NS_PER_MS) + (now.tv_nsec % NS_PER_MS >= 500000 ? 1 : 0) ;
-
+ 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);
-
- return (((long long)now.tv_sec) * MS_PER_S) + (now.tv_usec / MS_PER_S) + (now.tv_usec % MS_PER_S >= 500 ? 1 : 0);
-
+ return
+ (((long long)now.tv_sec) * MS_PER_S) +
+ (now.tv_usec / MS_PER_S) +
+ (now.tv_usec % MS_PER_S >= 500 ? 1 : 0);
#endif // defined(HAVE_GETTIMEDAY)
}
+
};
}}} // facebook::thrift::concurrency
-#endif // !defined(_concurrency_Util_h_)
+#endif // #ifndef _THRIFT_CONCURRENCY_UTIL_H_