X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9ad8644e6bfafa45a5fbca4c357da13454746a49..9c340da9ffa670c20c3658a2be43d35868a9f5d9:/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp index c36df0cd..f24614c9 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp @@ -15,7 +15,7 @@ */ /* - * Author : Maxim Mamontov + * Author : Maksym Mamontov */ /* @@ -34,6 +34,8 @@ #include "stg/common.h" #include "postgresql_store.h" +extern volatile time_t stgTime; + int POSTGRESQL_STORE::StartTransaction() const { PGresult * result = PQexec(connection, "BEGIN"); @@ -110,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;