[ 
https://issues.apache.org/jira/browse/GEODE-3392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16253822#comment-16253822
 ] 

ASF GitHub Bot commented on GEODE-3392:
---------------------------------------

pivotal-jbarrett closed pull request #150: GEODE-3392: Converts CacheStatistics 
to std::chrono.
URL: https://github.com/apache/geode-native/pull/150
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/clicache/src/AttributesFactory.cpp 
b/clicache/src/AttributesFactory.cpp
index 1627150f..98c4efc5 100644
--- a/clicache/src/AttributesFactory.cpp
+++ b/clicache/src/AttributesFactory.cpp
@@ -36,7 +36,7 @@
 #include "IFixedPartitionResolver.hpp"
 #include "impl/SafeConvert.hpp"
 #include "ExceptionTypes.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 #include "begin_native.hpp"
 #include <memory>
@@ -227,7 +227,7 @@ namespace Apache
       {
         try
         {
-          
m_nativeptr->get()->setEntryIdleTimeout(static_cast<native::ExpirationAction::Action>(
 action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
+          
m_nativeptr->get()->setEntryIdleTimeout(static_cast<native::ExpirationAction::Action>(
 action ), TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) 
);
         }
         finally
         {
@@ -240,7 +240,7 @@ namespace Apache
       {
         try
         {
-          m_nativeptr->get()->setEntryTimeToLive( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
+          m_nativeptr->get()->setEntryTimeToLive( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
         }
         finally
         {
@@ -253,7 +253,7 @@ namespace Apache
       {
         try
         {
-          m_nativeptr->get()->setRegionIdleTimeout( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
+          m_nativeptr->get()->setRegionIdleTimeout( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
         }
         finally
         {
@@ -266,7 +266,7 @@ namespace Apache
       {
         try
         {
-          m_nativeptr->get()->setRegionTimeToLive( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
+          m_nativeptr->get()->setRegionTimeToLive( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
         }
         finally
         {
diff --git a/clicache/src/AttributesMutator.cpp 
b/clicache/src/AttributesMutator.cpp
index aa106ca1..9bf74380 100644
--- a/clicache/src/AttributesMutator.cpp
+++ b/clicache/src/AttributesMutator.cpp
@@ -23,7 +23,7 @@
 #include "impl/CacheLoader.hpp"
 #include "impl/CacheWriter.hpp"
 #include "impl/CacheListener.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -40,7 +40,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->setEntryIdleTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->setEntryIdleTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) ));
         }
         finally
         {
@@ -69,7 +69,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->setEntryTimeToLive( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->setEntryTimeToLive( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) ));
         }
         finally
         {
@@ -98,7 +98,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->setRegionIdleTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->setRegionIdleTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) ));
         }
         finally
         {
@@ -127,7 +127,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->setRegionTimeToLive( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->setRegionTimeToLive( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) ));
         }
         finally
         {
diff --git a/clicache/src/CacheStatistics.cpp b/clicache/src/CacheStatistics.cpp
index 42592460..c053a3dc 100644
--- a/clicache/src/CacheStatistics.cpp
+++ b/clicache/src/CacheStatistics.cpp
@@ -16,7 +16,7 @@
  */
 
 #include "CacheStatistics.hpp"
-
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -27,11 +27,11 @@ namespace Apache
 
       using namespace System;
 
-      System::UInt32 CacheStatistics::LastModifiedTime::get( )
+      System::DateTime CacheStatistics::LastModifiedTime::get( )
       {
         try
         {
-          return m_nativeptr->get()->getLastModifiedTime( );
+          return 
TimeUtils::TimePointToDateTime(m_nativeptr->get()->getLastModifiedTime());
         }
         finally
         {
@@ -39,11 +39,11 @@ namespace Apache
         }
       }
 
-      System::UInt32 CacheStatistics::LastAccessedTime::get()
+      System::DateTime CacheStatistics::LastAccessedTime::get()
       {
         try
         {
-          return m_nativeptr->get()->getLastAccessedTime();
+          return 
TimeUtils::TimePointToDateTime(m_nativeptr->get()->getLastAccessedTime());
         }
         finally
         {
diff --git a/clicache/src/CacheStatistics.hpp b/clicache/src/CacheStatistics.hpp
index 8a1decef..cc026873 100644
--- a/clicache/src/CacheStatistics.hpp
+++ b/clicache/src/CacheStatistics.hpp
@@ -58,10 +58,6 @@ namespace Apache
         /// value provided by a loader. The modification time on a region is
         /// propagated upward to parent regions, transitively, to the root 
region.
         /// </para><para>
-        /// The number is expressed as the number of milliseconds since 
January 1, 1970.
-        /// The granularity may be as coarse as 100ms, so the accuracy may be 
off by
-        /// up to 50ms.
-        /// </para><para>
         /// Entry and subregion creation will update the modification time on a
         /// region, but <c>Region.Destroy</c>, <c>Region.DestroyRegion</c>,
         /// <c>Region.Invalidate</c>, and <c>Region.InvalidateRegion</c>
@@ -70,22 +66,17 @@ namespace Apache
         /// </remarks>
         /// <returns>
         /// the last modification time of the region or the entry;
-        /// returns 0 if the entry is invalid or the modification time is 
uninitialized.
         /// </returns>
         /// <seealso cref="Region.Put" />
         /// <seealso cref="Region.Get" />
         /// <seealso cref="Region.Create" />
         /// <seealso cref="Region.CreateSubRegion" />
-        property System::UInt32 LastModifiedTime
+        property System::DateTime LastModifiedTime
         {
           /// <summary>
           /// Get the last modified time of an entry or a region.
           /// </summary>
-          /// <returns>
-          /// the last accessed time expressed as the number of milliseconds 
since
-          /// January 1, 1970.
-          /// </returns>
-          System::UInt32 get( );
+          System::DateTime get( );
         }
 
         /// <summary>
@@ -99,28 +90,19 @@ namespace Apache
         /// so <c>LastAccessedTime</c> is always greater than or equal to
         /// <c>LastModifiedTime</c>. The <c>LastAccessedTime</c> on a region is
         /// propagated upward to parent regions, transitively, to the the root 
region.
-        /// </para><para>
-        /// The number is expressed as the number of milliseconds since
-        /// January 1, 1970. The granularity may be as coarse as 100ms, so
-        /// the accuracy may be off by up to 50ms.
         /// </para>
         /// </remarks>
         /// <returns>
         /// the last access time of the region or the entry's value;
-        /// returns 0 if entry is invalid or access time is uninitialized.
         /// </returns>
         /// <seealso cref="Region.Get" />
         /// <seealso cref="LastModifiedTime" />
-        property System::UInt32 LastAccessedTime
+        property System::DateTime LastAccessedTime
         {
           /// <summary>
           /// Get the last accessed time of an entry or a region.
           /// </summary>
-          /// <returns>
-          /// the last accessed time expressed as the number of milliseconds 
since
-          /// January 1, 1970.
-          /// </returns>
-          System::UInt32 get( );
+          System::DateTime get( );
         }
 
 
diff --git a/clicache/src/CacheTransactionManager.cpp 
b/clicache/src/CacheTransactionManager.cpp
index 1159c86c..640e7877 100644
--- a/clicache/src/CacheTransactionManager.cpp
+++ b/clicache/src/CacheTransactionManager.cpp
@@ -19,7 +19,7 @@
 #include "impl/ManagedTransactionListener.hpp"
 #include "impl/ManagedTransactionWriter.hpp"
 #include "CacheTransactionManager.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -187,7 +187,7 @@ namespace Apache
 
           try
           {
-            return m_nativeptr->get()->tryResume(transactionId->GetNative(), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(waitTime));
+            return m_nativeptr->get()->tryResume(transactionId->GetNative(), 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(waitTime));
           }
           finally
           {
diff --git a/clicache/src/CqQuery.cpp b/clicache/src/CqQuery.cpp
index bf156c98..3d430e20 100644
--- a/clicache/src/CqQuery.cpp
+++ b/clicache/src/CqQuery.cpp
@@ -25,7 +25,7 @@
 #include "ResultSet.hpp"
 #include "StructSet.hpp"
 #include "ExceptionTypes.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -40,7 +40,7 @@ namespace Apache
       generic<class TKey, class TResult>
       ICqResults<TResult>^ CqQuery<TKey, TResult>::ExecuteWithInitialResults()
       {
-        return 
ExecuteWithInitialResults(TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
+        return 
ExecuteWithInitialResults(TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
       }
 
       generic<class TKey, class TResult>
@@ -49,7 +49,7 @@ namespace Apache
         _GF_MG_EXCEPTION_TRY2/* due to auto replace */
           try
           {
-            auto nativeptr = 
m_nativeptr->get()->executeWithInitialResults(TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
+            auto nativeptr = 
m_nativeptr->get()->executeWithInitialResults(TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
  
             if (auto structptr = 
std::dynamic_pointer_cast<native::StructSet>(nativeptr))
             {
diff --git a/clicache/src/Execution.cpp b/clicache/src/Execution.cpp
index 8b564b67..eeaf03f0 100644
--- a/clicache/src/Execution.cpp
+++ b/clicache/src/Execution.cpp
@@ -27,7 +27,7 @@
 #include "impl/ManagedString.hpp"
 #include "ExceptionTypes.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 using namespace System;
 
@@ -112,7 +112,7 @@ namespace Apache
         try
         {
           ManagedString mg_function(func);
-          auto rc = m_nativeptr->get()->execute(mg_function.CharPtr, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
+          auto rc = m_nativeptr->get()->execute(mg_function.CharPtr, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
           if (m_rc == nullptr)
             return gcnew ResultCollector<TResult>(rc);
           else
@@ -128,7 +128,7 @@ namespace Apache
       generic<class TResult>
       IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func)
       {
-        return Execute(func, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
+        return Execute(func, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
       }
     }  // namespace Client
   }  // namespace Geode
diff --git a/clicache/src/Pool.cpp b/clicache/src/Pool.cpp
index 025af314..78756196 100644
--- a/clicache/src/Pool.cpp
+++ b/clicache/src/Pool.cpp
@@ -22,7 +22,7 @@
 #include "impl/ManagedString.hpp"
 #include "ExceptionTypes.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 
 namespace Apache
@@ -52,7 +52,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getFreeConnectionTimeout());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getFreeConnectionTimeout());
         }
         finally
         {
@@ -66,7 +66,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getLoadConditioningInterval());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getLoadConditioningInterval());
         }
         finally
         {
@@ -94,7 +94,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getReadTimeout());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getReadTimeout());
         }
         finally
         {
@@ -136,7 +136,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getIdleTimeout());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getIdleTimeout());
         }
         finally
         {
@@ -150,7 +150,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getPingInterval());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getPingInterval());
         }
         finally
         {
@@ -164,7 +164,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getUpdateLocatorListInterval());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getUpdateLocatorListInterval());
         }
         finally
         {
@@ -178,7 +178,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getStatisticInterval());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getStatisticInterval());
         }
         finally
         {
@@ -248,7 +248,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getSubscriptionMessageTrackingTimeout());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getSubscriptionMessageTrackingTimeout());
         }
         finally
         {
@@ -262,7 +262,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getSubscriptionAckInterval());
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getSubscriptionAckInterval());
         }
         finally
         {
diff --git a/clicache/src/PoolFactory.cpp b/clicache/src/PoolFactory.cpp
index 26b03cd3..2e8e3902 100644
--- a/clicache/src/PoolFactory.cpp
+++ b/clicache/src/PoolFactory.cpp
@@ -23,7 +23,7 @@
 #include "impl/ManagedString.hpp"
 #include "ExceptionTypes.hpp"
 #include "Cache.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -40,7 +40,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setFreeConnectionTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(connectionTimeout)
 );
+                           m_nativeptr->get()->setFreeConnectionTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(connectionTimeout) 
);
                          }
                          finally
                          {
@@ -58,7 +58,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setLoadConditioningInterval( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(loadConditioningInterval)
 );
+                           m_nativeptr->get()->setLoadConditioningInterval( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(loadConditioningInterval)
 );
                          }
                          finally
                          {
@@ -94,7 +94,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setReadTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) );
+                           m_nativeptr->get()->setReadTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) );
                          }
                          finally
                          {
@@ -148,7 +148,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setIdleTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(idleTimeout) );
+                           m_nativeptr->get()->setIdleTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(idleTimeout) );
                          }
                          finally
                          {
@@ -184,7 +184,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setPingInterval( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(pingInterval) 
);
+                           m_nativeptr->get()->setPingInterval( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(pingInterval) );
                          }
                          finally
                          {
@@ -202,7 +202,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setUpdateLocatorListInterval( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(updateLocatorListInterval)
 );
+                           m_nativeptr->get()->setUpdateLocatorListInterval( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(updateLocatorListInterval)
 );
                          }
                          finally
                          {
@@ -220,7 +220,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setStatisticInterval( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(statisticInterval)
 );
+                           m_nativeptr->get()->setStatisticInterval( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(statisticInterval) 
);
                          }
                          finally
                          {
@@ -349,7 +349,7 @@ namespace Apache
 
                          try
                          {
-                           
m_nativeptr->get()->setSubscriptionMessageTrackingTimeout( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(messageTrackingTimeout)
 );
+                           
m_nativeptr->get()->setSubscriptionMessageTrackingTimeout( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(messageTrackingTimeout)
 );
                          }
                          finally
                          {
@@ -367,7 +367,7 @@ namespace Apache
 
                          try
                          {
-                           m_nativeptr->get()->setSubscriptionAckInterval( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(ackInterval) );
+                           m_nativeptr->get()->setSubscriptionAckInterval( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(ackInterval) );
                          }
                          finally
                          {
diff --git a/clicache/src/Query.cpp b/clicache/src/Query.cpp
index 6b9b7d08..2140caa3 100644
--- a/clicache/src/Query.cpp
+++ b/clicache/src/Query.cpp
@@ -21,7 +21,7 @@
 #include "StructSet.hpp"
 #include "ExceptionTypes.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -36,7 +36,7 @@ namespace Apache
       generic<class TResult>
       ISelectResults<TResult>^ Query<TResult>::Execute(  )
       {
-        return Execute( 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT) );
+        return Execute( 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT) );
       }
 
       generic<class TResult>
@@ -46,7 +46,7 @@ namespace Apache
 
           try
           {
-            return WrapResults( m_nativeptr->get()->execute( 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) ));
+            return WrapResults( m_nativeptr->get()->execute( 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) ));
           }
           finally
           {
@@ -59,7 +59,7 @@ namespace Apache
       generic<class TResult>
       ISelectResults<TResult>^ Query<TResult>::Execute( array<Object^>^ 
paramList)
       {
-        return Execute(paramList, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
+        return Execute(paramList, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
       }
 
       generic<class TResult>
@@ -76,7 +76,7 @@ namespace Apache
 
           try
           {
-            return WrapResults( m_nativeptr->get()->execute(rsptr, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) ));
+            return WrapResults( m_nativeptr->get()->execute(rsptr, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout) ));
           }
           finally
           {
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index 357becc9..db9288c4 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -38,7 +38,7 @@
 #include "PoolManager.hpp"
 #include "SystemProperties.hpp"
 #include "impl/CacheResolver.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -593,7 +593,7 @@ namespace Apache
       {
         _GF_MG_EXCEPTION_TRY2/* due to auto replace */
 
-          return PutAll(map, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_RESPONSE_TIMEOUT));
+          return PutAll(map, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_RESPONSE_TIMEOUT));
 
         _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
 
@@ -613,7 +613,7 @@ namespace Apache
         }
         try
         {
-          m_nativeptr->get()->putAll(nativeMap, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
+          m_nativeptr->get()->putAll(nativeMap, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
         }
         finally
         {
@@ -639,7 +639,7 @@ namespace Apache
         std::shared_ptr<native::Serializable> callbackptr = 
Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
         try
         {
-          m_nativeptr->get()->putAll(nativeMap, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout), 
callbackptr);
+          m_nativeptr->get()->putAll(nativeMap, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout), callbackptr);
         }
         finally
         {
@@ -1355,7 +1355,7 @@ namespace Apache
       generic<class TResult>
       ISelectResults<TResult>^ Region<TKey, TValue>::Query(String^ predicate)
       {
-        return Query<TResult>( predicate, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT ));
+        return Query<TResult>( predicate, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT ));
       }
 
       generic<class TKey, class TValue>
@@ -1368,7 +1368,7 @@ namespace Apache
 
           try
           {
-            auto selectResults = 
m_nativeptr->get()->query(mg_predicate.CharPtr, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
+            auto selectResults = 
m_nativeptr->get()->query(mg_predicate.CharPtr, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
             if (auto resultptr = 
std::dynamic_pointer_cast<native::ResultSet>(selectResults))
             {
               return ResultSet<TResult>::Create(resultptr);
@@ -1390,7 +1390,7 @@ namespace Apache
       generic<class TKey, class TValue>
       bool Region<TKey, TValue>::ExistsValue(String^ predicate)
       {
-        return ExistsValue(predicate, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
+        return ExistsValue(predicate, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
       }
 
       generic<class TKey, class TValue>
@@ -1402,7 +1402,7 @@ namespace Apache
 
           try
           {
-            return m_nativeptr->get()->existsValue(mg_predicate.CharPtr, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
+            return m_nativeptr->get()->existsValue(mg_predicate.CharPtr, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
           }
           finally
           {
@@ -1416,7 +1416,7 @@ namespace Apache
       generic<class TKey, class TValue>
       Object^ Region<TKey, TValue>::SelectValue(String^ predicate)
       {
-        return SelectValue(predicate, 
TimeSpanUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
+        return SelectValue(predicate, 
TimeUtils::DurationToTimeSpan(native::DEFAULT_QUERY_RESPONSE_TIMEOUT));
       }
 
       generic<class TKey, class TValue>
@@ -1428,7 +1428,7 @@ namespace Apache
 
         try
         {
-          auto nativeptr = 
m_nativeptr->get()->selectValue(mg_predicate.CharPtr, 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
+          auto nativeptr = 
m_nativeptr->get()->selectValue(mg_predicate.CharPtr, 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeout));
           return Serializable::GetManagedValueGeneric<Object^>(nativeptr);
         }
         finally
diff --git a/clicache/src/RegionAttributes.cpp 
b/clicache/src/RegionAttributes.cpp
index e9ddd8f6..34f5e90c 100644
--- a/clicache/src/RegionAttributes.cpp
+++ b/clicache/src/RegionAttributes.cpp
@@ -33,7 +33,7 @@
 #include "CacheListenerAdapter.hpp"
 #include "CacheWriterAdapter.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -164,7 +164,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getRegionTimeToLive( ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getRegionTimeToLive( ));
         }
         finally
         {
@@ -190,7 +190,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getRegionIdleTimeout( ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getRegionIdleTimeout( ));
         }
         finally
         {
@@ -216,7 +216,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getEntryTimeToLive( ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getEntryTimeToLive( ));
         }
         finally
         {
@@ -242,7 +242,7 @@ namespace Apache
       {
         try
         {
-          return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->get()->getEntryIdleTimeout( ));
+          return 
TimeUtils::DurationToTimeSpan(m_nativeptr->get()->getEntryIdleTimeout( ));
         }
         finally
         {
diff --git a/clicache/src/RegionFactory.cpp b/clicache/src/RegionFactory.cpp
index d7656cac..aa167a5d 100644
--- a/clicache/src/RegionFactory.cpp
+++ b/clicache/src/RegionFactory.cpp
@@ -34,7 +34,7 @@
 #include "impl/FixedPartitionResolver.hpp"
 #include "impl/FixedPartitionResolver.hpp"
 #include "impl/PersistenceManagerProxy.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -121,7 +121,7 @@ namespace Apache
       {
         try
         {
-          m_nativeptr->get()->setEntryIdleTimeout( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
+          m_nativeptr->get()->setEntryIdleTimeout( 
static_cast<native::ExpirationAction::Action>( action ), 
TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
         }
         finally
         {
@@ -134,7 +134,7 @@ namespace Apache
       {
         try
         {
-          
m_nativeptr->get()->setEntryTimeToLive(static_cast<native::ExpirationAction::Action>(
 action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
+          
m_nativeptr->get()->setEntryTimeToLive(static_cast<native::ExpirationAction::Action>(
 action ), TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) 
);
         }
         finally
         {
@@ -147,7 +147,7 @@ namespace Apache
       {
         try
         {
-          
m_nativeptr->get()->setRegionIdleTimeout(static_cast<native::ExpirationAction::Action>(
 action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) );
+          
m_nativeptr->get()->setRegionIdleTimeout(static_cast<native::ExpirationAction::Action>(
 action ), TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(idleTimeout) 
);
         }
         finally
         {
@@ -160,7 +160,7 @@ namespace Apache
       {
         try
         {
-          
m_nativeptr->get()->setRegionTimeToLive(static_cast<native::ExpirationAction::Action>(
 action ), 
TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) );
+          
m_nativeptr->get()->setRegionTimeToLive(static_cast<native::ExpirationAction::Action>(
 action ), TimeUtils::TimeSpanToDurationCeil<std::chrono::seconds>(timeToLive) 
);
         }
         finally
         {
diff --git a/clicache/src/ResultCollector.cpp b/clicache/src/ResultCollector.cpp
index 3904cfce..d6390f7c 100644
--- a/clicache/src/ResultCollector.cpp
+++ b/clicache/src/ResultCollector.cpp
@@ -20,7 +20,7 @@
 #include "impl/ManagedString.hpp"
 #include "ExceptionTypes.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 using namespace System;
 
@@ -54,7 +54,7 @@ namespace Apache
       generic<class TResult>
       System::Collections::Generic::ICollection<TResult>^  
ResultCollector<TResult>::GetResult()
       {
-        return GetResult( 
TimeSpanUtils::DurationToTimeSpan(DEFAULT_QUERY_RESPONSE_TIMEOUT) );
+        return GetResult( 
TimeUtils::DurationToTimeSpan(DEFAULT_QUERY_RESPONSE_TIMEOUT) );
       }
 
       generic<class TResult>
@@ -63,7 +63,7 @@ namespace Apache
         _GF_MG_EXCEPTION_TRY2/* due to auto replace */
           try
           {
-            auto results = 
m_nativeptr->get()->getResult(TimeSpanUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
+            auto results = 
m_nativeptr->get()->getResult(TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
             auto rs = gcnew array<TResult>(results->size());
             for (System::Int32 index = 0; index < results->size(); index++)
             {
diff --git a/clicache/src/SystemProperties.cpp 
b/clicache/src/SystemProperties.cpp
index 099fd49b..474c08ae 100644
--- a/clicache/src/SystemProperties.cpp
+++ b/clicache/src/SystemProperties.cpp
@@ -17,7 +17,7 @@
 
 #include "SystemProperties.hpp"
 #include "impl/SafeConvert.hpp"
-#include "TimeSpanUtils.hpp"
+#include "TimeUtils.hpp"
 
 namespace Apache
 {
@@ -36,7 +36,7 @@ namespace Apache
 
       TimeSpan SystemProperties::StatisticsSampleInterval::get( )
       {
-        return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->statisticsSampleInterval( ));
+        return 
TimeUtils::DurationToTimeSpan(m_nativeptr->statisticsSampleInterval( ));
       }
 
       bool SystemProperties::StatisticsEnabled::get( )
@@ -81,22 +81,22 @@ namespace Apache
       
       TimeSpan SystemProperties::PingInterval::get( )
       {
-        return TimeSpanUtils::DurationToTimeSpan(m_nativeptr->pingInterval( ));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->pingInterval( ));
       }
       
       TimeSpan SystemProperties::RedundancyMonitorInterval::get( )
       {
-        return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->redundancyMonitorInterval( ));
+        return 
TimeUtils::DurationToTimeSpan(m_nativeptr->redundancyMonitorInterval( ));
       }
       
       TimeSpan SystemProperties::NotifyAckInterval::get( )
       {
-        return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->notifyAckInterval( ));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->notifyAckInterval( 
));
       }
       
       TimeSpan SystemProperties::NotifyDupCheckLife::get( )
       {
-        return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->notifyDupCheckLife( ));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->notifyDupCheckLife( 
));
       }
       
       bool SystemProperties::DebugStackTraceEnabled::get( )
@@ -183,12 +183,12 @@ namespace Apache
 
       TimeSpan SystemProperties::DurableTimeout::get( )
       {
-        return TimeSpanUtils::DurationToTimeSpan(m_nativeptr->durableTimeout( 
));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->durableTimeout( ));
       }
 
       TimeSpan SystemProperties::ConnectTimeout::get( )
       {
-        return TimeSpanUtils::DurationToTimeSpan(m_nativeptr->connectTimeout( 
));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->connectTimeout( ));
       }
 
       String^ SystemProperties::ConflateEvents::get( )
@@ -198,7 +198,7 @@ namespace Apache
 
       TimeSpan SystemProperties::SuspendedTxTimeout::get( )
       {
-        return 
TimeSpanUtils::DurationToTimeSpan(m_nativeptr->suspendedTxTimeout( ));
+        return TimeUtils::DurationToTimeSpan(m_nativeptr->suspendedTxTimeout( 
));
       }
 
        bool SystemProperties::OnClientDisconnectClearPdxTypeIds::get( )
diff --git a/clicache/src/TimeSpanUtils.hpp b/clicache/src/TimeUtils.hpp
similarity index 71%
rename from clicache/src/TimeSpanUtils.hpp
rename to clicache/src/TimeUtils.hpp
index 1afc5285..33e93b42 100644
--- a/clicache/src/TimeSpanUtils.hpp
+++ b/clicache/src/TimeUtils.hpp
@@ -33,7 +33,7 @@ namespace Apache
 
       using ticks = std::chrono::duration<long long, std::ratio<1, 10000000>>;
       
-      class TimeSpanUtils
+      class TimeUtils
       {
       public:
         template <class _Duration>
@@ -50,7 +50,24 @@ namespace Apache
         inline static TimeSpan DurationToTimeSpan(ticks duration)
         {
           return TimeSpan::FromTicks(duration.count());
-        }      
+        }    
+
+        inline static DateTime 
TimePointToDateTime(std::chrono::system_clock::time_point timePoint) {
+          using namespace std::chrono;
+          auto t = duration_cast<ticks>(timePoint.time_since_epoch());
+          t += epochDifference;
+          return DateTime(t.count());
+        }
+
+        inline static std::chrono::system_clock::time_point 
DateTimeToTimePoint(DateTime dateTime) {
+          using namespace std::chrono;
+          auto t = ticks(dateTime.Ticks);
+          t -= epochDifference;
+          return system_clock::time_point(t);
+        }
+
+      private:
+        static constexpr auto epochDifference = ticks(621355968000000000);
       };
     }  // namespace Client
   }  // namespace Geode
diff --git a/clicache/test/CMakeLists.txt b/clicache/test/CMakeLists.txt
index d5900789..7993e68c 100644
--- a/clicache/test/CMakeLists.txt
+++ b/clicache/test/CMakeLists.txt
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 cmake_minimum_required(VERSION 3.4)
-project(Apache.Geode.Test)
+project(Apache.Geode.Test CXX)
 
 file(GLOB SOURCES "*.cpp")
 
@@ -52,6 +52,8 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
   COMPILE_FLAGS "/clr"
   VS_GLOBAL_CLRSupport "true"
   VS_GLOBAL_KEYWORD "ManagedCProj"
+  VS_GLOBAL_TestProjectType UnitTest
+  VS_GLOBAL_PROJECT_TYPES 
"{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
   VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
   VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
   VS_DOTNET_REFERENCES 
"System;System.Xml;Microsoft.VisualStudio.QualityTools.UnitTestFramework"
@@ -63,6 +65,7 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} 
${SHARED_LINKER_FLAG
 
 include_directories(${CMAKE_SOURCE_DIR}/clicache/src)
 include_directories(${CMAKE_SOURCE_DIR}/cppcache/src)
+include_directories(${CMAKE_SOURCE_DIR}/cppcache/include)
 #PCH issues
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
diff --git a/clicache/test/TimeUtilsTests.cpp b/clicache/test/TimeUtilsTests.cpp
new file mode 100644
index 00000000..d8909342
--- /dev/null
+++ b/clicache/test/TimeUtilsTests.cpp
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "begin_native.hpp"
+#include <chrono>
+#include "end_native.hpp"
+#include "TimeUtils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace std::chrono;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+  [TestClass]
+  public ref class TimeUtilsTests
+  {
+  private:
+    TestContext^ testContextInstance;
+
+  public: 
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ 
TestContext
+    {
+      Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+      {
+        return testContextInstance;
+      }
+      System::Void 
set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+      {
+        testContextInstance = value;
+      }
+    };
+
+    #pragma region Additional test attributes
+    //
+    //You can use the following additional attributes as you write your tests:
+    //
+    //Use ClassInitialize to run code before running the first test in the 
class
+    //[ClassInitialize()]
+    //static void MyClassInitialize(TestContext^ testContext) {};
+    //
+    //Use ClassCleanup to run code after all tests in a class have run
+    //[ClassCleanup()]
+    //static void MyClassCleanup() {};
+    //
+    //Use TestInitialize to run code before running each test
+    //[TestInitialize()]
+    //void MyTestInitialize() {};
+    //
+    //Use TestCleanup to run code after each test has run
+    //[TestCleanup()]
+    //void MyTestCleanup() {};
+    //
+    #pragma endregion 
+
+    [TestMethod]
+    void TimePointToDateTime()
+    {
+      auto testSystemEpoch = DateTime(1970, 1, 1, 0, 0, 0, 0, gcnew 
System::Globalization::GregorianCalendar(), DateTimeKind::Utc);
+      Assert::AreEqual(621355968000000000, testSystemEpoch.Ticks);
+
+      auto systemEpoch = 
TimeUtils::TimePointToDateTime(system_clock::time_point());
+      Assert::AreEqual(621355968000000000, systemEpoch.Ticks);
+
+      auto systemNextDay = system_clock::time_point() + hours(24);
+      auto netNextDay = testSystemEpoch.AddDays(1);
+      auto convertedNextDay = TimeUtils::TimePointToDateTime(systemNextDay);
+      Assert::AreEqual(netNextDay, convertedNextDay);
+    }
+
+    [TestMethod]
+    void DateTimeToTimePoint()
+    {
+      const auto netEpoch = TimeUtils::DateTimeToTimePoint(DateTime(0));
+      Assert::AreEqual(-621355968000000000, 
ticks{netEpoch.time_since_epoch()}.count());
+    }
+
+  };
+}
diff --git a/cppcache/include/geode/CacheStatistics.hpp 
b/cppcache/include/geode/CacheStatistics.hpp
index fc65f896..f127b104 100644
--- a/cppcache/include/geode/CacheStatistics.hpp
+++ b/cppcache/include/geode/CacheStatistics.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_CACHESTATISTICS_H_
-#define GEODE_CACHESTATISTICS_H_
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -20,9 +15,16 @@
  * limitations under the License.
  */
 
+#pragma once
+
+#ifndef GEODE_CACHESTATISTICS_H_
+#define GEODE_CACHESTATISTICS_H_
+
+#include <atomic>
+#include <chrono>
+
 #include "geode_globals.hpp"
 #include "geode_types.hpp"
-#include <atomic>
 
 /**
  * @file
@@ -35,48 +37,47 @@ namespace client {
 class LocalRegion;
 
 /**
-*@class CacheStatistics CacheStatistics.hpp
-*
-*Defines common statistical information
-*for both the region and its entries. All of these methods may throw a
-*CacheClosedException, RegionDestroyedException, or EntryDestroyedException.
-*
-*@see Region::getStatistics
-*@see RegionEntry::getStatistics
-*/
-class CPPCACHE_EXPORT CacheStatistics  {
+ *@class CacheStatistics CacheStatistics.hpp
+ *
+ *Defines common statistical information
+ *for both the region and its entries. All of these methods may throw a
+ *CacheClosedException, RegionDestroyedException, or EntryDestroyedException.
+ *
+ *@see Region::getStatistics
+ *@see RegionEntry::getStatistics
+ */
+class CPPCACHE_EXPORT CacheStatistics {
  public:
-  CacheStatistics();
+  typedef std::chrono::system_clock::time_point time_point;
 
-  virtual ~CacheStatistics();
+  CacheStatistics()
+      : m_lastAccessTime(time_point()), m_lastModifiedTime(time_point()){};
+  CacheStatistics(const CacheStatistics&) = delete;
+  virtual ~CacheStatistics() = default;
 
-  /** For an entry, returns the time that the entry's value was last modified.
+  /**
+   * For an entry, returns the time that the entry's value was last modified.
    * For a region, returns the last time any of the region's entries' values or
    * the values in subregions' entries were modified. The
    * modification may have been initiated locally, or it may have been an 
update
    * distributed from another cache. It may also have been a new value provided
    * by a loader. The modification time on a region is propagated upward to
-   * parent
-   * regions, transitively, to the root region.
-   * <p>
-   * The number is expressed as the number of milliseconds since January 1,
-   * 1970.
-   * The granularity may be as coarse as 100ms, so the accuracy may be off by
-   * up to 50ms.
+   * parent regions, transitively, to the root region.
    * <p>
    * Entry and subregion creation will update the modification time on a
    * region, but <code>destroy</code>, <code>destroyRegion</code>,
    * <code>invalidate</code>, and <code>invalidateRegion</code>
    * do not update the modification time.
    * @return the last modification time of the region or the entry;
-   * returns 0 if the entry is invalid or the modification time is
-   * uninitialized.
+   * returns std::chrono::system_clock epoch if the entry is invalid or the
+   * modification time is uninitialized.
+   *
    * @see Region::put
    * @see Region::get
    * @see Region::create
    * @see Region::createSubregion
    */
-  virtual uint32_t getLastModifiedTime() const;
+  virtual time_point getLastModifiedTime() const;
 
   /**
    * For an entry, returns the last time it was accessed via
@@ -87,28 +88,26 @@ class CPPCACHE_EXPORT CacheStatistics  {
    * <code>lastAccessedTime</code> is always <code>>= lastModifiedTime</code>.
    * The <code>lastAccessedTime</code> on a region is propagated upward to
    * parent regions, transitively, to the the root region.
-   * <p>
-   * The number is expressed as the number of milliseconds
-   * since January 1, 1970.
-   * The granularity may be as coarse as 100ms, so the accuracy may be off by
-   * up to 50ms.
    *
    * @return the last access time of the region or the entry's value;
-   * returns 0 if entry is invalid or access time is uninitialized.
+   * returns std::chrono::system_clock epoch if the entry is invalid or the
+   * modification time is uninitialized.
+   *
    * @see Region::get
    * @see getLastModifiedTime
    */
-  virtual uint32_t getLastAccessedTime() const;
+  virtual time_point getLastAccessedTime() const;
 
  private:
-  virtual void setLastAccessedTime(uint32_t lat);
-  virtual void setLastModifiedTime(uint32_t lmt);
+  virtual void setLastAccessedTime(time_point lat);
+  virtual void setLastModifiedTime(time_point lmt);
 
-  std::atomic<uint32_t> m_lastAccessTime;
-  std::atomic<uint32_t> m_lastModifiedTime;
+  std::atomic<time_point> m_lastAccessTime;
+  std::atomic<time_point> m_lastModifiedTime;
 
   friend class LocalRegion;
 };
+
 }  // namespace client
 }  // namespace geode
 }  // namespace apache
diff --git a/cppcache/integration-test/CacheHelper.cpp 
b/cppcache/integration-test/CacheHelper.cpp
index b18f1225..869f5d69 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -243,7 +243,8 @@ CacheHelper::CacheHelper(const bool isthinClient, const 
char* poolName,
     poolFactory->setSubscriptionEnabled(clientNotification);
     poolFactory->setMultiuserAuthentication(isMultiuserMode);
     if (loadConditioningInterval > 0) {
-      
poolFactory->setLoadConditioningInterval(std::chrono::milliseconds(loadConditioningInterval));
+      poolFactory->setLoadConditioningInterval(
+          std::chrono::milliseconds(loadConditioningInterval));
     }
     printf("Setting connections to %d ", connections);
     if (connections >= 0) {
@@ -251,7 +252,8 @@ CacheHelper::CacheHelper(const bool isthinClient, const 
char* poolName,
       poolFactory->setMaxConnections(connections);
     }
     if (subscriptionAckInterval != -1) {
-      
poolFactory->setSubscriptionAckInterval(std::chrono::milliseconds(subscriptionAckInterval));
+      poolFactory->setSubscriptionAckInterval(
+          std::chrono::milliseconds(subscriptionAckInterval));
     }
 
     poolFactory->create(poolName);
@@ -447,7 +449,8 @@ std::shared_ptr<Pool> CacheHelper::createPool(
   poolFacPtr->setMultiuserAuthentication(isMultiuserMode);
   // poolFacPtr->setStatisticInterval(1000);
   if (loadConditioningInterval > 0) {
-    
poolFacPtr->setLoadConditioningInterval(std::chrono::milliseconds(loadConditioningInterval));
+    poolFacPtr->setLoadConditioningInterval(
+        std::chrono::milliseconds(loadConditioningInterval));
   }
 
   if (connections >= 0) {
@@ -487,33 +490,38 @@ std::shared_ptr<Pool> CacheHelper::createPool2(
     poolFacPtr->setMaxConnections(connections);
   }
   if (subscriptionAckInterval != -1) {
-    
poolFacPtr->setSubscriptionAckInterval(std::chrono::milliseconds(subscriptionAckInterval));
+    poolFacPtr->setSubscriptionAckInterval(
+        std::chrono::milliseconds(subscriptionAckInterval));
   }
 
   return poolFacPtr->create(poolName);
 }
 
 void CacheHelper::logPoolAttributes(std::shared_ptr<Pool>& pool) {
+  using namespace apache::geode::util::chrono::duration;
   LOG("logPoolAttributes() entered");
   LOGINFO("CPPTEST: Pool attribtes for pool %s are as follows:",
           pool->getName());
-  LOGINFO("getFreeConnectionTimeout: %d", pool->getFreeConnectionTimeout());
-  LOGINFO("getLoadConditioningInterval: %d",
-          pool->getLoadConditioningInterval());
+  LOGINFO("getFreeConnectionTimeout: %s",
+          to_string(pool->getFreeConnectionTimeout()).c_str());
+  LOGINFO("getLoadConditioningInterval: %s",
+          to_string(pool->getLoadConditioningInterval()).c_str());
   LOGINFO("getSocketBufferSize: %d", pool->getSocketBufferSize());
-  LOGINFO("getReadTimeout: %d", pool->getReadTimeout());
+  LOGINFO("getReadTimeout: %s", to_string(pool->getReadTimeout()).c_str());
   LOGINFO("getMinConnections: %d", pool->getMinConnections());
   LOGINFO("getMaxConnections: %d", pool->getMaxConnections());
-  LOGINFO("getIdleTimeout: %d", pool->getIdleTimeout());
-  LOGINFO("getPingInterval: %d", pool->getPingInterval());
-  LOGINFO("getStatisticInterval: %d", pool->getStatisticInterval());
+  LOGINFO("getIdleTimeout: %s", to_string(pool->getIdleTimeout()).c_str());
+  LOGINFO("getPingInterval: %s", to_string(pool->getPingInterval()).c_str());
+  LOGINFO("getStatisticInterval: %s",
+          to_string(pool->getStatisticInterval()).c_str());
   LOGINFO("getRetryAttempts: %d", pool->getRetryAttempts());
   LOGINFO("getSubscriptionEnabled: %s",
           pool->getSubscriptionEnabled() ? "true" : "false");
   LOGINFO("getSubscriptionRedundancy: %d", pool->getSubscriptionRedundancy());
-  LOGINFO("getSubscriptionMessageTrackingTimeout: %d",
-          pool->getSubscriptionMessageTrackingTimeout());
-  LOGINFO("getSubscriptionAckInterval: %d", 
pool->getSubscriptionAckInterval());
+  LOGINFO("getSubscriptionMessageTrackingTimeout: %s",
+          to_string(pool->getSubscriptionMessageTrackingTimeout()).c_str());
+  LOGINFO("getSubscriptionAckInterval: %s",
+          to_string(pool->getSubscriptionAckInterval()).c_str());
   LOGINFO("getServerGroup: %s", pool->getServerGroup());
   LOGINFO("getThreadLocalConnections: %s",
           pool->getThreadLocalConnections() ? "true" : "false");
@@ -582,7 +590,8 @@ std::shared_ptr<Region> 
CacheHelper::createRegionAndAttachPool2(
   return regionFactory.create(name);
 }
 
-void CacheHelper::addServerLocatorEPs(const char* epList, 
std::shared_ptr<PoolFactory> pfPtr,
+void CacheHelper::addServerLocatorEPs(const char* epList,
+                                      std::shared_ptr<PoolFactory> pfPtr,
                                       bool poolLocators) {
   std::unordered_set<std::string> endpointNames;
   Utils::parseEndpointNamesString(epList, endpointNames);
@@ -788,25 +797,26 @@ std::shared_ptr<Region> 
CacheHelper::createPooledRegionDiscOverFlow(
   }
   return regionFactory.create(name);
 }
- std::shared_ptr<Region> CacheHelper::createPooledRegionSticky(
+std::shared_ptr<Region> CacheHelper::createPooledRegionSticky(
     const char* name, bool ack, const char* locators, const char* poolName,
     bool caching, bool clientNotificationEnabled,
     const std::chrono::seconds& ettl, const std::chrono::seconds& eit,
     const std::chrono::seconds& rttl, const std::chrono::seconds& rit, int lel,
-    const std::shared_ptr<CacheListener>& cacheListener, 
ExpirationAction::Action action) {
- auto poolFacPtr = getCache()->getPoolManager().createFactory();
- poolFacPtr->setSubscriptionEnabled(clientNotificationEnabled);
- poolFacPtr->setThreadLocalConnections(true);
- poolFacPtr->setPRSingleHopEnabled(false);
+    const std::shared_ptr<CacheListener>& cacheListener,
+    ExpirationAction::Action action) {
+  auto poolFacPtr = getCache()->getPoolManager().createFactory();
+  poolFacPtr->setSubscriptionEnabled(clientNotificationEnabled);
+  poolFacPtr->setThreadLocalConnections(true);
+  poolFacPtr->setPRSingleHopEnabled(false);
 
- LOG("adding pool locators");
- addServerLocatorEPs(locators, poolFacPtr);
+  LOG("adding pool locators");
+  addServerLocatorEPs(locators, poolFacPtr);
 
- if ((getCache()->getPoolManager().find(poolName)) ==
-     nullptr) {  // Pool does not exist with the same name.
-   auto pptr = poolFacPtr->create(poolName);
-   LOG("createPooledRegionSticky logPoolAttributes");
-   logPoolAttributes(pptr);
+  if ((getCache()->getPoolManager().find(poolName)) ==
+      nullptr) {  // Pool does not exist with the same name.
+    auto pptr = poolFacPtr->create(poolName);
+    LOG("createPooledRegionSticky logPoolAttributes");
+    logPoolAttributes(pptr);
   }
 
   RegionShortcut preDefRA = PROXY;
@@ -828,12 +838,13 @@ std::shared_ptr<Region> 
CacheHelper::createPooledRegionDiscOverFlow(
   }
   return regionFactory.create(name);
 }
- std::shared_ptr<Region> CacheHelper::createPooledRegionStickySingleHop(
+std::shared_ptr<Region> CacheHelper::createPooledRegionStickySingleHop(
     const char* name, bool ack, const char* locators, const char* poolName,
     bool caching, bool clientNotificationEnabled,
     const std::chrono::seconds& ettl, const std::chrono::seconds& eit,
     const std::chrono::seconds& rttl, const std::chrono::seconds& rit, int lel,
-    const std::shared_ptr<CacheListener>& cacheListener, 
ExpirationAction::Action action) {
+    const std::shared_ptr<CacheListener>& cacheListener,
+    ExpirationAction::Action action) {
   LOG("createPooledRegionStickySingleHop");
  auto poolFacPtr = getCache()->getPoolManager().createFactory();
  poolFacPtr->setSubscriptionEnabled(clientNotificationEnabled);
@@ -868,9 +879,9 @@ std::shared_ptr<Region> 
CacheHelper::createPooledRegionDiscOverFlow(
   }
   return regionFactory.create(name);
 }
- std::shared_ptr<Region> CacheHelper::createSubregion(std::shared_ptr<Region>& 
parent, const char* name,
-                                       bool ack, bool caching,
-                                       const std::shared_ptr<CacheListener>& 
listener) {
+std::shared_ptr<Region> CacheHelper::createSubregion(
+    std::shared_ptr<Region>& parent, const char* name, bool ack, bool caching,
+    const std::shared_ptr<CacheListener>& listener) {
   AttributesFactory af;
   af.setCachingEnabled(caching);
   if (listener != nullptr) {
diff --git a/cppcache/src/CacheStatistics.cpp b/cppcache/src/CacheStatistics.cpp
index d825946a..03a352ad 100644
--- a/cppcache/src/CacheStatistics.cpp
+++ b/cppcache/src/CacheStatistics.cpp
@@ -17,27 +17,26 @@
 
 #include <geode/CacheStatistics.hpp>
 
-using namespace apache::geode::client;
+namespace apache {
+namespace geode {
+namespace client {
 
-CacheStatistics::CacheStatistics() {
-  m_lastModifiedTime = 0;
-  m_lastAccessTime = 0;
-}
-
-CacheStatistics::~CacheStatistics() {}
-
-void CacheStatistics::setLastModifiedTime(uint32_t lmt) {
+void CacheStatistics::setLastModifiedTime(time_point lmt) {
   m_lastModifiedTime = lmt;
 }
 
-void CacheStatistics::setLastAccessedTime(uint32_t lat) {
+void CacheStatistics::setLastAccessedTime(time_point lat) {
   m_lastAccessTime = lat;
 }
 
-uint32_t CacheStatistics::getLastModifiedTime() const {
+CacheStatistics::time_point CacheStatistics::getLastModifiedTime() const {
   return m_lastModifiedTime;
 }
 
-uint32_t CacheStatistics::getLastAccessedTime() const {
+CacheStatistics::time_point CacheStatistics::getLastAccessedTime() const {
   return m_lastAccessTime;
 }
+
+}  // namespace client
+}  // namespace geode
+}  // namespace apache
diff --git a/cppcache/src/CacheTransactionManagerImpl.cpp 
b/cppcache/src/CacheTransactionManagerImpl.cpp
index ecf55941..57f038f8 100644
--- a/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -457,7 +457,7 @@ void 
CacheTransactionManagerImpl::resumeTxUsingTxState(TXState* txState,
         txState->getSuspendedExpiryTaskId());
   } else {
     CacheRegionHelper::getCacheImpl(m_cache)->getExpiryTaskManager().resetTask(
-        txState->getSuspendedExpiryTaskId(), 0);
+        txState->getSuspendedExpiryTaskId(), std::chrono::seconds(0));
   }
 
   // set the current state as the state of the suspended transaction
diff --git a/cppcache/src/EntryExpiryHandler.cpp 
b/cppcache/src/EntryExpiryHandler.cpp
index a4a383d0..53229d76 100644
--- a/cppcache/src/EntryExpiryHandler.cpp
+++ b/cppcache/src/EntryExpiryHandler.cpp
@@ -33,7 +33,7 @@ using namespace apache::geode::client;
 EntryExpiryHandler::EntryExpiryHandler(std::shared_ptr<RegionInternal>& rptr,
                                        std::shared_ptr<MapEntryImpl>& entryPtr,
                                        ExpirationAction::Action action,
-                                       uint32_t duration)
+                                       std::chrono::seconds duration)
     : m_regionPtr(rptr),
       m_entryPtr(entryPtr),
       m_action(action),
@@ -45,31 +45,33 @@ int EntryExpiryHandler::handle_timeout(const 
ACE_Time_Value& current_time,
   m_entryPtr->getKeyI(key);
   ExpEntryProperties& expProps = m_entryPtr->getExpProperties();
   try {
-    uint32_t curr_time = static_cast<uint32_t>(current_time.sec());
+    auto curr_time = 
std::chrono::system_clock::from_time_t(current_time.sec());
 
-    uint32_t lastTimeForExp = expProps.getLastAccessTime();
+    auto lastTimeForExp = expProps.getLastAccessTime();
     if (m_regionPtr->getAttributes()->getEntryTimeToLive().count() > 0) {
       lastTimeForExp = expProps.getLastModifiedTime();
     }
 
-    int32_t sec = curr_time - lastTimeForExp - m_duration;
+    auto elapsed = curr_time - lastTimeForExp;
     LOGDEBUG(
         "Entered entry expiry task handler for key [%s] of region [%s]: "
         "%d,%d,%d,%d",
         Utils::getCacheableKeyString(key)->asChar(), 
m_regionPtr->getFullPath(),
-        curr_time, lastTimeForExp, m_duration, sec);
-    if (sec >= 0) {
+        curr_time.time_since_epoch().count(),
+        lastTimeForExp.time_since_epoch().count(), m_duration.count(),
+        elapsed.count());
+    if (elapsed >= m_duration) {
       DoTheExpirationAction(key);
     } else {
       // reset the task after
       // (lastAccessTime + entryExpiryDuration - curr_time) in seconds
+      auto remaining = m_duration - elapsed;
       LOGDEBUG(
-          "Resetting expiry task %d secs later for key [%s] of region "
-          "[%s]",
-          -sec, Utils::getCacheableKeyString(key)->asChar(),
+          "Resetting expiry task %d secs later for key [%s] of region [%s]",
+          remaining.count(), Utils::getCacheableKeyString(key)->asChar(),
           m_regionPtr->getFullPath());
       m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask(
-          expProps.getExpiryTaskId(), -sec);
+          expProps.getExpiryTaskId(), remaining);
       return 0;
     }
   } catch (...) {
@@ -79,7 +81,7 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& 
current_time,
            Utils::getCacheableKeyString(key)->asChar(),
            m_regionPtr->getFullPath());
   m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask(
-      expProps.getExpiryTaskId(), 0);
+      expProps.getExpiryTaskId(), std::chrono::seconds::zero());
   //  we now delete the handler in GF_Timer_Heap_ImmediateReset_T
   // and always return success.
 
diff --git a/cppcache/src/EntryExpiryHandler.hpp 
b/cppcache/src/EntryExpiryHandler.hpp
index ebc2d423..33dc8002 100644
--- a/cppcache/src/EntryExpiryHandler.hpp
+++ b/cppcache/src/EntryExpiryHandler.hpp
@@ -50,7 +50,8 @@ class CPPCACHE_EXPORT EntryExpiryHandler : public 
ACE_Event_Handler {
    */
   EntryExpiryHandler(std::shared_ptr<RegionInternal>& rptr,
                      std::shared_ptr<MapEntryImpl>& entryPtr,
-                     ExpirationAction::Action action, uint32_t duration);
+                     ExpirationAction::Action action,
+                     std::chrono::seconds duration);
 
   /** This task object will be registered with the Timer Queue.
    *  When the timer expires the handle_timeout is invoked.
@@ -70,7 +71,7 @@ class CPPCACHE_EXPORT EntryExpiryHandler : public 
ACE_Event_Handler {
   ExpirationAction::Action m_action;
   // Duration after which the task should be reset in case of
   // modification.
-  uint32_t m_duration;
+  std::chrono::seconds m_duration;
   // perform the actual expiration action
   void DoTheExpirationAction(const std::shared_ptr<CacheableKey>& key);
 };
diff --git a/cppcache/src/ExpiryTaskManager.cpp 
b/cppcache/src/ExpiryTaskManager.cpp
index 4130f4bc..ca7b10ff 100644
--- a/cppcache/src/ExpiryTaskManager.cpp
+++ b/cppcache/src/ExpiryTaskManager.cpp
@@ -61,20 +61,6 @@ long 
ExpiryTaskManager::scheduleExpiryTask(ACE_Event_Handler* handler,
   return m_reactor->schedule_timer(handler, 0, expTimeValue, intervalValue);
 }
 
-long ExpiryTaskManager::scheduleExpiryTask(
-    ACE_Event_Handler* handler, const std::chrono::microseconds expTime,
-    const std::chrono::microseconds interval, const bool cancelExistingTask) {
-  LOGFINER("ExpiryTaskManager: expTime %d, interval %d, cancelExistingTask %d",
-           expTime.count(), interval.count(), cancelExistingTask);
-  if (cancelExistingTask) {
-    m_reactor->cancel_timer(handler, 1);
-  }
-
-  const ACE_Time_Value expTimeValue(expTime);
-  const ACE_Time_Value intervalValue(interval);
-  return m_reactor->schedule_timer(handler, 0, expTimeValue, intervalValue);
-}
-
 long ExpiryTaskManager::scheduleExpiryTask(ACE_Event_Handler* handler,
                                            ACE_Time_Value expTimeValue,
                                            ACE_Time_Value intervalVal,
diff --git a/cppcache/src/ExpiryTaskManager.hpp 
b/cppcache/src/ExpiryTaskManager.hpp
index 64983a00..6c16aee1 100644
--- a/cppcache/src/ExpiryTaskManager.hpp
+++ b/cppcache/src/ExpiryTaskManager.hpp
@@ -235,11 +235,6 @@ class CPPCACHE_EXPORT ExpiryTaskManager : public 
ACE_Task_Base {
                           bool cancelExistingTask = false);
 
   long scheduleExpiryTask(ACE_Event_Handler* handler,
-                          const std::chrono::microseconds expTime,
-                          const std::chrono::microseconds interval,
-                          const bool cancelExistingTask = false);
-
-  long scheduleExpiryTask(ACE_Event_Handler* handler,
                           ACE_Time_Value expTimeValue,
                           ACE_Time_Value intervalVal,
                           bool cancelExistingTask = false);
@@ -248,7 +243,7 @@ class CPPCACHE_EXPORT ExpiryTaskManager : public 
ACE_Task_Base {
   long scheduleExpiryTask(ACE_Event_Handler* handler,
                           std::chrono::duration<ExpRep, ExpPeriod> expTime,
                           std::chrono::duration<IntRep, IntPeriod> interval,
-                          bool cancelExistingTask) {
+                          bool cancelExistingTask = false) {
     LOGFINER(
         "ExpiryTaskManager: expTime %s, interval %s, cancelExistingTask %d",
         util::chrono::duration::to_string(expTime).c_str(),
@@ -272,6 +267,13 @@ class CPPCACHE_EXPORT ExpiryTaskManager : public 
ACE_Task_Base {
    * invoked from the current time.
    */
   int resetTask(id_type id, uint32_t sec);
+
+  template <class Rep, class Period>
+  int resetTask(id_type id, std::chrono::duration<Rep, Period> duration) {
+    ACE_Time_Value interval(duration);
+    return m_reactor->reset_timer_interval(id, interval);
+  }
+
   /**
    * for cancelling an already registered task.
    * returns '0' if successful '-1' on failure.
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index a96f8303..4ddfb739 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -108,14 +108,14 @@ std::shared_ptr<Region> LocalRegion::getParentRegion() 
const {
 void LocalRegion::updateAccessAndModifiedTime(bool modified) {
   // locking not required since setters use atomic operations
   if (regionExpiryEnabled()) {
-    time_t currTime = ACE_OS::gettimeofday().sec();
+    auto now = std::chrono::system_clock::now();
     LOGDEBUG("Setting last accessed time for region %s to %d", getFullPath(),
-             currTime);
-    m_cacheStatistics->setLastAccessedTime(static_cast<uint32_t>(currTime));
+             now.time_since_epoch().count());
+    m_cacheStatistics->setLastAccessedTime(now);
     if (modified) {
       LOGDEBUG("Setting last modified time for region %s to %d", getFullPath(),
-               currTime);
-      m_cacheStatistics->setLastModifiedTime(static_cast<uint32_t>(currTime));
+               now.time_since_epoch().count());
+      m_cacheStatistics->setLastModifiedTime(now);
     }
     // TODO:  should we really touch the parent region??
     RegionInternal* ri = dynamic_cast<RegionInternal*>(m_parentRegion.get());
@@ -661,16 +661,17 @@ void LocalRegion::setRegionExpiryTask() {
   if (regionExpiryEnabled()) {
     auto rptr = std::static_pointer_cast<RegionInternal>(shared_from_this());
     const auto& duration = getRegionExpiryDuration();
-    auto handler = new RegionExpiryHandler(rptr, getRegionExpiryAction(),
-                                           duration.count());
-    int64_t expiryTaskId =
+    auto handler =
+        new RegionExpiryHandler(rptr, getRegionExpiryAction(), duration);
+    auto expiryTaskId =
         rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
-            handler, duration.count(), 0);
+            handler, duration, std::chrono::seconds::zero());
     handler->setExpiryTaskId(expiryTaskId);
     LOGFINE(
         "expiry for region [%s], expiry task id = %d, duration = %d, "
         "action = %d",
-        m_fullPath.c_str(), expiryTaskId, duration.count(), 
getRegionExpiryAction());
+        m_fullPath.c_str(), expiryTaskId, duration.count(),
+        getRegionExpiryAction());
   }
 }
 
@@ -682,10 +683,10 @@ void LocalRegion::registerEntryExpiryTask(
   expProps.initStartTime();
   auto rptr = std::static_pointer_cast<RegionInternal>(shared_from_this());
   const auto& duration = getEntryExpiryDuration();
-  auto handler = new EntryExpiryHandler(rptr, entry, 
getEntryExpirationAction(),
-                                        duration.count());
+  auto handler =
+      new EntryExpiryHandler(rptr, entry, getEntryExpirationAction(), 
duration);
   int64_t id = rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
-      handler, duration.count(), 0);
+      handler, duration, std::chrono::seconds::zero());
   if (Log::finestEnabled()) {
     std::shared_ptr<CacheableKey> key;
     entry->getKeyI(key);
@@ -2755,7 +2756,7 @@ void 
LocalRegion::updateAccessAndModifiedTimeForEntry(std::shared_ptr<MapEntryIm
   // locking is not required since setters use atomic operations
   if (ptr != nullptr && entryExpiryEnabled()) {
     ExpEntryProperties& expProps = ptr->getExpProperties();
-    uint32_t currTime = static_cast<uint32_t>(ACE_OS::gettimeofday().sec());
+    auto currTime = std::chrono::system_clock::now();
     std::shared_ptr<CacheableString> keyStr;
     if (Log::debugEnabled()) {
       std::shared_ptr<CacheableKey> key;
@@ -2763,11 +2764,13 @@ void 
LocalRegion::updateAccessAndModifiedTimeForEntry(std::shared_ptr<MapEntryIm
       keyStr = Utils::getCacheableKeyString(key);
     }
     LOGDEBUG("Setting last accessed time for key [%s] in region %s to %d",
-             keyStr->asChar(), getFullPath(), currTime);
+             keyStr->asChar(), getFullPath(),
+             currTime.time_since_epoch().count());
     expProps.updateLastAccessTime(currTime);
     if (modified) {
       LOGDEBUG("Setting last modified time for key [%s] in region %s to %d",
-               keyStr->asChar(), getFullPath(), currTime);
+               keyStr->asChar(), getFullPath(),
+               currTime.time_since_epoch().count());
       expProps.updateLastModifiedTime(currTime);
     }
   }
@@ -2885,7 +2888,7 @@ bool LocalRegion::isStatisticsEnabled() {
 
 bool LocalRegion::useModifiedTimeForRegionExpiry() {
   const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
-  if (region_ttl.count() > 0) {
+  if (region_ttl > std::chrono::seconds::zero()) {
     return true;
   } else {
     return false;
@@ -2893,7 +2896,7 @@ bool LocalRegion::useModifiedTimeForRegionExpiry() {
 }
 
 bool LocalRegion::useModifiedTimeForEntryExpiry() {
-  if (m_regionAttributes->getEntryTimeToLive().count() > 0) {
+  if (m_regionAttributes->getEntryTimeToLive() > std::chrono::seconds::zero()) 
{
     return true;
   } else {
     return false;
@@ -2902,7 +2905,8 @@ bool LocalRegion::useModifiedTimeForEntryExpiry() {
 
 bool LocalRegion::isEntryIdletimeEnabled() {
   if (m_regionAttributes->getCachingEnabled() &&
-      0 != m_regionAttributes->getEntryIdleTimeout().count()) {
+      m_regionAttributes->getEntryIdleTimeout() >
+          std::chrono::seconds::zero()) {
     return true;
   } else {
     return false;
@@ -2919,7 +2923,7 @@ ExpirationAction::Action 
LocalRegion::getEntryExpirationAction() const {
 
 ExpirationAction::Action LocalRegion::getRegionExpiryAction() const {
   const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
-  if (region_ttl.count() > 0) {
+  if (region_ttl > std::chrono::seconds::zero()) {
     return m_regionAttributes->getRegionTimeToLiveAction();
   } else {
     return m_regionAttributes->getRegionIdleTimeoutAction();
@@ -2929,7 +2933,7 @@ ExpirationAction::Action 
LocalRegion::getRegionExpiryAction() const {
 std::chrono::seconds LocalRegion::getRegionExpiryDuration() const {
   const auto& region_ttl = m_regionAttributes->getRegionTimeToLive();
   const auto& region_idle = m_regionAttributes->getRegionIdleTimeout();
-  if (region_ttl.count() > 0) {
+  if (region_ttl > std::chrono::seconds::zero()) {
     return region_ttl;
   } else {
     return region_idle;
@@ -2940,7 +2944,7 @@ std::chrono::seconds 
LocalRegion::getEntryExpiryDuration() const {
   const auto& entry_ttl = m_regionAttributes->getEntryTimeToLive();
   const auto& entry_idle = m_regionAttributes->getEntryIdleTimeout();
 
-  if (entry_ttl.count() > 0) {
+  if (entry_ttl > std::chrono::seconds::zero()) {
     return entry_ttl;
   } else {
     return entry_idle;
diff --git a/cppcache/src/MapEntry.hpp b/cppcache/src/MapEntry.hpp
index 4037af90..6a536c9d 100644
--- a/cppcache/src/MapEntry.hpp
+++ b/cppcache/src/MapEntry.hpp
@@ -19,11 +19,14 @@
 
 #ifndef GEODE_MAPENTRY_H_
 #define GEODE_MAPENTRY_H_
+
 #include <atomic>
+#include <memory>
+#include <utility>
+
 #include <geode/geode_globals.hpp>
 #include <geode/Cacheable.hpp>
 #include <geode/CacheableKey.hpp>
-#include <memory>
 #include <geode/ExceptionTypes.hpp>
 
 #include "CacheImpl.hpp"
@@ -31,8 +34,6 @@
 #include "RegionInternal.hpp"
 #include "CacheableToken.hpp"
 #include "VersionStamp.hpp"
-#include <ace/OS.h>
-#include <utility>
 
 namespace apache {
 namespace geode {
@@ -49,9 +50,11 @@ class CacheImpl;
  */
 class CPPCACHE_EXPORT ExpEntryProperties {
  public:
+  typedef std::chrono::system_clock::time_point time_point;
+
   inline ExpEntryProperties(ExpiryTaskManager* expiryTaskManager)
-      : m_lastAccessTime(0),
-        m_lastModifiedTime(0),
+      : m_lastAccessTime(time_point()),
+        m_lastModifiedTime(time_point()),
         m_expiryTaskId(-1),
         m_expiryTaskManager(expiryTaskManager) {
     // The reactor always gives +ve id while scheduling.
@@ -59,23 +62,22 @@ class CPPCACHE_EXPORT ExpEntryProperties {
     // for this entry. // TODO confirm
   }
 
-  inline uint32_t getLastAccessTime() const { return m_lastAccessTime; }
+  inline time_point getLastAccessTime() const { return m_lastAccessTime; }
 
-  inline uint32_t getLastModifiedTime() const { return m_lastModifiedTime; }
+  inline time_point getLastModifiedTime() const { return m_lastModifiedTime; }
 
   //  moved time initialization outside of constructor to avoid
   // the costly gettimeofday call in MapSegment spinlock
   inline void initStartTime() {
-    uint32_t currTime = static_cast<uint32_t>(ACE_OS::gettimeofday().sec());
-    m_lastModifiedTime = currTime;
-    m_lastAccessTime = currTime;
+    m_lastModifiedTime = std::chrono::system_clock::now();
+    m_lastAccessTime = std::chrono::system_clock::now();
   }
 
-  inline void updateLastAccessTime(uint32_t currTime) {
+  inline void updateLastAccessTime(time_point currTime) {
     m_lastAccessTime = currTime;
   }
 
-  inline void updateLastModifiedTime(uint32_t currTime) {
+  inline void updateLastModifiedTime(time_point currTime) {
     m_lastModifiedTime = currTime;
   }
 
@@ -91,13 +93,14 @@ class CPPCACHE_EXPORT ExpEntryProperties {
 
  protected:
   // this constructor deliberately skips initializing any fields
-  inline explicit ExpEntryProperties(bool noInit) {}
+  inline explicit ExpEntryProperties(bool noInit)
+      : m_lastAccessTime(time_point()), m_lastModifiedTime(time_point()) {}
 
  private:
   /** last access time in secs, 32bit.. */
-  std::atomic<uint32_t> m_lastAccessTime;
+  std::atomic<time_point> m_lastAccessTime;
   /** last modified time in secs, 32bit.. */
-  std::atomic<uint32_t> m_lastModifiedTime;
+  std::atomic<time_point> m_lastModifiedTime;
   /** The expiry task id for this particular entry.. **/
   long m_expiryTaskId;
   ExpiryTaskManager* m_expiryTaskManager;
diff --git a/cppcache/src/RegionExpiryHandler.cpp 
b/cppcache/src/RegionExpiryHandler.cpp
index cd0aae81..4632160b 100644
--- a/cppcache/src/RegionExpiryHandler.cpp
+++ b/cppcache/src/RegionExpiryHandler.cpp
@@ -32,7 +32,7 @@ using namespace apache::geode::client;
 
 RegionExpiryHandler::RegionExpiryHandler(std::shared_ptr<RegionInternal>& rptr,
                                          ExpirationAction::Action action,
-                                         uint32_t duration)
+                                         std::chrono::seconds duration)
     : m_regionPtr(rptr),
       m_action(action),
       m_duration(duration),
@@ -43,33 +43,36 @@ 
RegionExpiryHandler::RegionExpiryHandler(std::shared_ptr<RegionInternal>& rptr,
 
 int RegionExpiryHandler::handle_timeout(const ACE_Time_Value& current_time,
                                         const void* arg) {
-  time_t curr_time = current_time.sec();
+  auto curr_time = std::chrono::system_clock::from_time_t(current_time.sec());
   try {
-    auto ptr = m_regionPtr->getStatistics();
-    uint32_t lastTimeForExp = ptr->getLastAccessedTime();
-    if (m_regionPtr->getAttributes()->getRegionTimeToLive().count() > 0) {
-      lastTimeForExp = ptr->getLastModifiedTime();
+    auto statistics = m_regionPtr->getStatistics();
+    auto lastTimeForExp = statistics->getLastAccessedTime();
+    if (m_regionPtr->getAttributes()->getRegionTimeToLive() >
+        std::chrono::seconds::zero()) {
+      lastTimeForExp = statistics->getLastModifiedTime();
     }
 
-    int32_t sec = static_cast<int32_t>(curr_time) - lastTimeForExp - 
m_duration;
+    auto elapsed = curr_time - lastTimeForExp;
     LOGDEBUG("Entered region expiry task handler for region [%s]: %d,%d,%d,%d",
-             m_regionPtr->getFullPath(), curr_time, lastTimeForExp, m_duration,
-             sec);
-    if (sec >= 0) {
+             m_regionPtr->getFullPath(), curr_time.time_since_epoch().count(),
+             lastTimeForExp.time_since_epoch().count(), m_duration.count(),
+             elapsed.count());
+    if (elapsed >= m_duration) {
       DoTheExpirationAction();
     } else {
+      auto remaining = m_duration - elapsed;
       // reset the task after
       // (lastAccessTime + entryExpiryDuration - curr_time) in seconds
       LOGDEBUG("Resetting expiry task for region [%s] after %d sec",
-               m_regionPtr->getFullPath(), -sec);
+               m_regionPtr->getFullPath(), remaining.count());
       m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask(
-          m_expiryTaskId, -sec);
+          m_expiryTaskId, remaining);
       return 0;
     }
     LOGDEBUG("Removing expiry task for region [%s]",
              m_regionPtr->getFullPath());
     m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask(
-        m_expiryTaskId, 0);
+        m_expiryTaskId, std::chrono::seconds::zero());
   } catch (...) {
     // Ignore whatever exception comes
   }
diff --git a/cppcache/src/RegionExpiryHandler.hpp 
b/cppcache/src/RegionExpiryHandler.hpp
index 00f3426b..ba0c2da1 100644
--- a/cppcache/src/RegionExpiryHandler.hpp
+++ b/cppcache/src/RegionExpiryHandler.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_REGIONEXPIRYHANDLER_H_
-#define GEODE_REGIONEXPIRYHANDLER_H_
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -20,6 +15,13 @@
  * limitations under the License.
  */
 
+#pragma once
+
+#ifndef GEODE_REGIONEXPIRYHANDLER_H_
+#define GEODE_REGIONEXPIRYHANDLER_H_
+
+#include <ace/Time_Value_T.h>
+
 #include <geode/geode_globals.hpp>
 #include <geode/Region.hpp>
 #include <geode/ExpirationAction.hpp>
@@ -48,7 +50,8 @@ class CPPCACHE_EXPORT RegionExpiryHandler : public 
ACE_Event_Handler {
    * Constructor
    */
   RegionExpiryHandler(std::shared_ptr<RegionInternal>& rptr,
-                      ExpirationAction::Action action, uint32_t duration);
+                      ExpirationAction::Action action,
+                      std::chrono::seconds duration);
 
   /** This handler object will be registered with the Timer Queue.
    *  When the timer expires the handle_timeout is invoked.
@@ -63,7 +66,7 @@ class CPPCACHE_EXPORT RegionExpiryHandler : public 
ACE_Event_Handler {
  private:
   std::shared_ptr<RegionInternal> m_regionPtr;
   ExpirationAction::Action m_action;
-  uint32_t m_duration;
+  std::chrono::seconds m_duration;
   long m_expiryTaskId;
   // perform the actual expiration action
   void DoTheExpirationAction();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Migrate CacheStatistics to use std::chrono
> ------------------------------------------
>
>                 Key: GEODE-3392
>                 URL: https://issues.apache.org/jira/browse/GEODE-3392
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Ernest Burghardt
>
>  virtual std::chrono::time_point getLastModifiedTime() const;
>   /**
>    * For an entry, returns the last time it was accessed via
>    * @see Region::get
>    * @see getLastModifiedTime
>    */
>   virtual std::chrono::time_point getLastAccessedTime() const;
>  private:
>   virtual void setLastAccessedTime(std::chrono::time_point lat);
>   virtual void setLastModifiedTime(std::chrono::time_point lmt);
>   std::atomic<std::chrono::time_point> m_lastAccessTime;
>   std::atomic<std::chrono::time_point> m_lastModifiedTime;



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to