You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/03/15 17:51:32 UTC
[31/34] geode-native git commit: GEODE-2552: Replaced NanoTimer with
std::chrono.
GEODE-2552: Replaced NanoTimer with std::chrono.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/786fff83
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/786fff83
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/786fff83
Branch: refs/heads/feature/GEODE-2602
Commit: 786fff83859703bd8c8bcb84388c72266b2b90dc
Parents: c0d0c2a
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Sat Feb 25 14:11:46 2017 -0800
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Wed Mar 15 10:44:24 2017 -0700
----------------------------------------------------------------------
src/cppcache/src/Utils.cpp | 4 +++-
src/cppcache/src/Utils.hpp | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/786fff83/src/cppcache/src/Utils.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Utils.cpp b/src/cppcache/src/Utils.cpp
index 0bb40ab..ac3449a 100644
--- a/src/cppcache/src/Utils.cpp
+++ b/src/cppcache/src/Utils.cpp
@@ -21,6 +21,7 @@
#include <ace/Recursive_Thread_Mutex.h>
#include <ace/INET_Addr.h>
#include <cstdio>
+#include <chrono>
using namespace apache::geode::client;
@@ -51,7 +52,8 @@ void operator delete[](void* p) { operator delete(p); }
#endif // _WIN32
int RandGen::operator()(size_t max) {
- unsigned int seed = static_cast<unsigned int>(NanoTimer::now());
+ unsigned int seed = static_cast<unsigned int>(
+ std::chrono::system_clock::now().time_since_epoch().count());
return ACE_OS::rand_r(&seed) % max;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/786fff83/src/cppcache/src/Utils.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Utils.hpp b/src/cppcache/src/Utils.hpp
index 56520c3..b95c7e8 100644
--- a/src/cppcache/src/Utils.hpp
+++ b/src/cppcache/src/Utils.hpp
@@ -36,6 +36,8 @@
#include <typeinfo>
#include <string>
#include <unordered_set>
+#include <chrono>
+
#ifdef __GNUC__
extern "C" {
#include <cxxabi.h>
@@ -152,7 +154,9 @@ class CPPCACHE_EXPORT Utils {
if (DistributedSystem::getSystemProperties() != NULL) {
return (DistributedSystem::getSystemProperties()
->getEnableTimeStatistics())
- ? NanoTimer::now()
+ ? std::chrono::duration_cast<std::chrono::nanoseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count()
: 0;
} else {
return 0;