GEODE-2408: Updated usage of deprecated CacheableDate.

Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/bc1a8fac
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/bc1a8fac
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/bc1a8fac

Branch: refs/heads/develop
Commit: bc1a8faccd7dceb2e37abe632ab809adc23e790a
Parents: 1d16b3b
Author: Jacob Barrett <[email protected]>
Authored: Tue Jan 31 22:15:07 2017 -0800
Committer: Jacob Barrett <[email protected]>
Committed: Mon Feb 13 13:41:41 2017 -0800

----------------------------------------------------------------------
 src/cppcache/src/CacheableDate.cpp              | 34 +++++++++-----------
 .../AutoPdxVersioned1.cpp                       |  8 ++---
 .../AutoPdxVersioned2.cpp                       |  8 ++---
 src/tests/cpp/testobject/InvalidPdxUsage.hpp    |  8 ++---
 src/tests/cpp/testobject/NonPdxType.hpp         |  8 ++---
 src/tests/cpp/testobject/PdxAutoMegaType.cpp    |  6 ++--
 src/tests/cpp/testobject/PdxType.hpp            |  8 ++---
 src/tests/cpp/testobject/PdxTypeWithAuto.hpp    |  8 ++---
 src/tests/cpp/testobject/PdxVersioned1.cpp      |  8 ++---
 src/tests/cpp/testobject/PdxVersioned2.cpp      |  8 ++---
 10 files changed, 33 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/cppcache/src/CacheableDate.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableDate.cpp 
b/src/cppcache/src/CacheableDate.cpp
index d208b43..02963cf 100644
--- a/src/cppcache/src/CacheableDate.cpp
+++ b/src/cppcache/src/CacheableDate.cpp
@@ -56,10 +56,10 @@ Serializable* CacheableDate::createDeserializable() {
 
 int32_t CacheableDate::classId() const { return 0; }
 
-int8_t CacheableDate::typeId() const { return GemfireTypeIds::CacheableDate; }
+int8_t CacheableDate::typeId() const { return GeodeTypeIds::CacheableDate; }
 
 bool CacheableDate::operator==(const CacheableKey& other) const {
-  if (other.typeId() != GemfireTypeIds::CacheableDate) {
+  if (other.typeId() != GeodeTypeIds::CacheableDate) {
     return false;
   }
 
@@ -68,28 +68,25 @@ bool CacheableDate::operator==(const CacheableKey& other) 
const {
   return m_timevalue == otherDt.m_timevalue;
 }
 
-int CacheableDate::day() const 
-{ 
-  struct tm date = { 0 };
+int CacheableDate::day() const {
+  struct tm date = {0};
   time_t sec = m_timevalue / 1000;
-  ACE_OS::localtime_r( &sec, &date );
+  ACE_OS::localtime_r(&sec, &date);
   return date.tm_mday;
 }
 
-int CacheableDate::month() const 
-{ 
-  struct tm date = { 0 };
+int CacheableDate::month() const {
+  struct tm date = {0};
   time_t sec = m_timevalue / 1000;
-  ACE_OS::localtime_r( &sec, &date );
-  return date.tm_mon + 1; 
+  ACE_OS::localtime_r(&sec, &date);
+  return date.tm_mon + 1;
 }
 
-int CacheableDate::year() const 
-{ 
-  struct tm date = { 0 };
+int CacheableDate::year() const {
+  struct tm date = {0};
   time_t sec = m_timevalue / 1000;
-  ACE_OS::localtime_r( &sec, &date );
-  return date.tm_year + 1900; 
+  ACE_OS::localtime_r(&sec, &date);
+  return date.tm_year + 1900;
 }
 
 int64_t CacheableDate::milliseconds() const
@@ -102,9 +99,8 @@ uint32_t CacheableDate::hashcode( ) const
   return (int) m_timevalue ^ (int) (m_timevalue >> 32);
 }
 
-CacheableDate::CacheableDate( const timeval& value )
-{ 
-  m_timevalue = (((int64_t) value.tv_sec) * 1000) + (value.tv_usec / 1000);
+CacheableDate::CacheableDate(const timeval& value) {
+  m_timevalue = (((int64_t)value.tv_sec) * 1000) + (value.tv_usec / 1000);
 }
 
 CacheableDate::CacheableDate( const time_t value )

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp 
b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp
index 0f9c1c6..95ce61f 100644
--- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp
+++ b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp
@@ -101,12 +101,8 @@ void AutoPdxVersioned1::init(const char* key) {
   m_charArray[0] = L'c';
   m_charArray[1] = L'v';
 
-  // time_t offset = 1310447869154L;
-  // m_date = CacheableDate::create(offset);
-  struct timeval now;
-  now.tv_sec = 1310447869;
-  now.tv_usec = 154000;
-  m_date = CacheableDate::create(now);
+  int64_t d = 1310447869154L;
+  m_date = CacheableDate::create(CacheableDate::duration(d));
 
   m_int16Array = new int16_t[2];
   m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp 
b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp
index c22e170..05e7d85 100644
--- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp
+++ b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp
@@ -106,12 +106,8 @@ void AutoPdxVersioned2::init(const char* key) {
   m_charArray[0] = L'c';
   m_charArray[1] = L'v';
 
-  // time_t offset = 1310447869154L;
-  // m_date = CacheableDate::create(offset);
-  struct timeval now;
-  now.tv_sec = 1310447869;
-  now.tv_usec = 154000;
-  m_date = CacheableDate::create(now);
+  int64_t d = 1310447869154L;
+  m_date = CacheableDate::create(CacheableDate::duration(d));
 
   m_int16Array = new int16_t[2];
   m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/InvalidPdxUsage.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/InvalidPdxUsage.hpp 
b/src/tests/cpp/testobject/InvalidPdxUsage.hpp
index 02ac607..042491b 100644
--- a/src/tests/cpp/testobject/InvalidPdxUsage.hpp
+++ b/src/tests/cpp/testobject/InvalidPdxUsage.hpp
@@ -340,12 +340,8 @@ class TESTOBJECT_EXPORT InvalidPdxUsage : public 
PdxSerializable {
     m_charArray[0] = L'c';
     m_charArray[1] = L'v';
 
-    // time_t offset = 1310447869154L;
-    // m_date = CacheableDate::create(offset);
-    struct timeval now;
-    now.tv_sec = 1310447869;
-    now.tv_usec = 154000;
-    m_date = CacheableDate::create(now);
+    int64_t d = 1310447869154L;
+    m_date = CacheableDate::create(CacheableDate::duration(d));
 
     m_int16Array = new int16_t[2];
     m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/NonPdxType.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/NonPdxType.hpp 
b/src/tests/cpp/testobject/NonPdxType.hpp
index f3b12b0..d685cfa 100644
--- a/src/tests/cpp/testobject/NonPdxType.hpp
+++ b/src/tests/cpp/testobject/NonPdxType.hpp
@@ -200,12 +200,8 @@ class TESTOBJECT_EXPORT NonPdxType {
     m_charArray[0] = 'c';
     m_charArray[1] = 'v';
 
-    // time_t offset = 1310447869154L;
-    // m_date = CacheableDate::create(offset);
-    struct timeval now;
-    now.tv_sec = 1310447869;
-    now.tv_usec = 154000;
-    m_date = CacheableDate::create(now);
+    int64_t d = 1310447869154L;
+    m_date = CacheableDate::create(CacheableDate::duration(d));
 
     m_int16Array = new int16_t[2];
     m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/PdxAutoMegaType.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxAutoMegaType.cpp 
b/src/tests/cpp/testobject/PdxAutoMegaType.cpp
index 2a40f72..837c8b7 100644
--- a/src/tests/cpp/testobject/PdxAutoMegaType.cpp
+++ b/src/tests/cpp/testobject/PdxAutoMegaType.cpp
@@ -36,10 +36,8 @@ void PdxAutoMegaType::populatePrimitives() {
   pdxType_Float = 23324.324f;
   pdxType_Double = 3243298498.00;
 
-  struct timeval now;
-  now.tv_sec = 1310447869;
-  now.tv_usec = 154000;
-  pdxType_Date = CacheableDate::create(now);
+  int64_t d = 1310447869154L;
+  pdxType_Date = CacheableDate::create(CacheableDate::duration(d));
 
   pdxType_String = (char*)"gfestring";
   pdxType_WideString = (wchar_t*)L"gfestring";

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/PdxType.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxType.hpp 
b/src/tests/cpp/testobject/PdxType.hpp
index a06bdd6..27fc4fb 100644
--- a/src/tests/cpp/testobject/PdxType.hpp
+++ b/src/tests/cpp/testobject/PdxType.hpp
@@ -439,12 +439,8 @@ class TESTOBJECT_EXPORT PdxType : public PdxSerializable {
     m_charArray[0] = L'c';
     m_charArray[1] = L'v';
 
-    // time_t offset = 1310447869154L;
-    // m_date = CacheableDate::create(offset);
-    struct timeval now;
-    now.tv_sec = 1310447869;
-    now.tv_usec = 154000;
-    m_date = CacheableDate::create(now);
+    int64_t d = 1310447869154L;
+    m_date = CacheableDate::create(CacheableDate::duration(d));
 
     m_int16Array = new int16_t[2];
     m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/PdxTypeWithAuto.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxTypeWithAuto.hpp 
b/src/tests/cpp/testobject/PdxTypeWithAuto.hpp
index 5ff14fa..5b879e2 100644
--- a/src/tests/cpp/testobject/PdxTypeWithAuto.hpp
+++ b/src/tests/cpp/testobject/PdxTypeWithAuto.hpp
@@ -450,12 +450,8 @@ class GFIGNORE(TESTOBJECT_EXPORT) PdxType : public 
PdxSerializable {
     m_charArray[0] = L'c';
     m_charArray[1] = L'v';
 
-    // time_t offset = 1310447869154L;
-    // m_date = CacheableDate::create(offset);
-    struct timeval now;
-    now.tv_sec = 1310447869;
-    now.tv_usec = 154000;
-    m_dateTime = CacheableDate::create(now);
+    int64_t d = 1310447869154L;
+    m_dateTime = CacheableDate::create(CacheableDate::duration(d));
 
     m_int16Array = new int16_t[2];
     m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/PdxVersioned1.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned1.cpp 
b/src/tests/cpp/testobject/PdxVersioned1.cpp
index f5bb477..8b418a4 100644
--- a/src/tests/cpp/testobject/PdxVersioned1.cpp
+++ b/src/tests/cpp/testobject/PdxVersioned1.cpp
@@ -153,12 +153,8 @@ void PdxVersioned1::init(const char* key) {
   m_charArray[0] = L'c';
   m_charArray[1] = L'v';
 
-  // time_t offset = 1310447869154L;
-  // m_date = CacheableDate::create(offset);
-  struct timeval now;
-  now.tv_sec = 1310447869;
-  now.tv_usec = 154000;
-  m_date = CacheableDate::create(now);
+  int64_t d = 1310447869154L;
+  m_date = CacheableDate::create(CacheableDate::duration(d));
 
   m_int16Array = new int16_t[2];
   m_int16Array[0] = 0x2332;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/bc1a8fac/src/tests/cpp/testobject/PdxVersioned2.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned2.cpp 
b/src/tests/cpp/testobject/PdxVersioned2.cpp
index 749daf3..6422846 100644
--- a/src/tests/cpp/testobject/PdxVersioned2.cpp
+++ b/src/tests/cpp/testobject/PdxVersioned2.cpp
@@ -157,12 +157,8 @@ void PdxVersioned2::init(const char* key) {
   m_charArray[0] = L'c';
   m_charArray[1] = L'v';
 
-  // time_t offset = 1310447869154L;
-  // m_date = CacheableDate::create(offset);
-  struct timeval now;
-  now.tv_sec = 1310447869;
-  now.tv_usec = 154000;
-  m_date = CacheableDate::create(now);
+  int64_t d = 1310447869154L;
+  m_date = CacheableDate::create(CacheableDate::duration(d));
 
   m_int16Array = new int16_t[2];
   m_int16Array[0] = 0x2332;

Reply via email to