]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp
Revert "Merge remote-tracking branch 'origin/master' into ticket37"
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_utils.cpp
index ef70505389fc372eb2425398903256a805e4882f..9845242991ab5e1f91f1706dffd6ab490adb5db9 100644 (file)
  *
  */
 
-#include "postgresql_store.h"
-
-#include "stg/common.h"
-
 #include <string>
 #include <ctime>
 
 #include <libpq-fe.h>
 
+#include "stg/common.h"
+#include "postgresql_store.h"
+
 extern volatile time_t stgTime;
 
 int POSTGRESQL_STORE::StartTransaction() const
@@ -94,10 +93,10 @@ int error = 0;
 char * buf = new char[(value.length() << 1) + 1];
 
 PQescapeStringConn(connection,
-                   buf,
-                   value.c_str(),
-                   value.length(),
-                   &error);
+                  buf,
+                  value.c_str(),
+                  value.length(),
+                  &error);
 
 if (error)
     {
@@ -113,35 +112,6 @@ delete[] buf;
 return 0;
 }
 
-std::string POSTGRESQL_STORE::Int2TS(time_t ts) const
-{
-struct tm brokenTime;
-
-brokenTime.tm_wday = 0;
-brokenTime.tm_yday = 0;
-brokenTime.tm_isdst = 0;
-
-gmtime_r(&ts, &brokenTime);
-
-char buf[32];
-strftime(buf, 32, "%Y-%m-%d %H:%M:%S", &brokenTime);
-
-return buf;
-}
-
-time_t POSTGRESQL_STORE::TS2Int(const std::string & ts) const
-{
-struct tm brokenTime;
-
-brokenTime.tm_wday = 0;
-brokenTime.tm_yday = 0;
-brokenTime.tm_isdst = 0;
-
-stg_strptime(ts.c_str(), "%Y-%m-%d %H:%M:%S", &brokenTime);
-
-return stg_timegm(&brokenTime);
-}
-
 void POSTGRESQL_STORE::MakeDate(std::string & date, int year, int month) const
 {
 struct tm brokenTime;
@@ -161,6 +131,8 @@ if (year)
 else
     {
     time_t curTime = stgTime;
+    /*time(&curTime);*/
+
     localtime_r(&curTime, &brokenTime);
     }
 
@@ -172,3 +144,4 @@ strftime(buf, 32, "%Y-%m-%d", &brokenTime);
 
 date = buf;
 }
+