]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp
Ticket 37. if (year < 1990) checking added in the ts2time() function.
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_utils.cpp
index 7c0755a7e3121d9f74c8020d82aa8ba9772e40d2..9845242991ab5e1f91f1706dffd6ab490adb5db9 100644 (file)
 
 #include <libpq-fe.h>
 
-#include "common.h"
-
+#include "stg/common.h"
 #include "postgresql_store.h"
 
+extern volatile time_t stgTime;
+
 int POSTGRESQL_STORE::StartTransaction() const
 {
 PGresult * result = PQexec(connection, "BEGIN");
@@ -111,36 +112,6 @@ delete[] buf;
 return 0;
 }
 
-std::string POSTGRESQL_STORE::Int2TS(uint32_t ts) const
-{
-char buf[32];
-struct tm brokenTime;
-time_t tt = ts;
-
-brokenTime.tm_wday = 0;
-brokenTime.tm_yday = 0;
-brokenTime.tm_isdst = 0;
-
-gmtime_r(&tt, &brokenTime);
-
-strftime(buf, 32, "%Y-%m-%d %H:%M:%S", &brokenTime);
-
-return buf;
-}
-
-uint32_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;