geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [20/21] geode-native git commit: GEODE-2552: Replaced NanoTimer with std::chrono.
Date Wed, 01 Mar 2017 23:35:25 GMT
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/6a9d7552
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/6a9d7552
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/6a9d7552

Branch: refs/heads/develop
Commit: 6a9d755206c214cb5d125f4794158153fb7b6be1
Parents: b48be22
Author: Jacob Barrett <jbarrett@pivotal.io>
Authored: Sat Feb 25 14:11:46 2017 -0800
Committer: Jacob Barrett <jbarrett@pivotal.io>
Committed: Wed Mar 1 15:30:08 2017 -0800

----------------------------------------------------------------------
 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/6a9d7552/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/6a9d7552/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;


Mime
View raw message