X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9baba54e426108683f706dced3c36059588bc077..ed482e49fcd8341061473ff39e683a951b84da20:/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 7c0755a7..f5dec89f 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp @@ -31,10 +31,11 @@ #include -#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,24 +112,23 @@ delete[] buf; return 0; } -std::string POSTGRESQL_STORE::Int2TS(uint32_t ts) const +std::string POSTGRESQL_STORE::Int2TS(time_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); +gmtime_r(&ts, &brokenTime); strftime(buf, 32, "%Y-%m-%d %H:%M:%S", &brokenTime); return buf; } -uint32_t POSTGRESQL_STORE::TS2Int(const std::string & ts) const +time_t POSTGRESQL_STORE::TS2Int(const std::string & ts) const { struct tm brokenTime;