X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/1347f3d1e04bedd1508589173f577673ee2c5554..68ff250b88c43acf959cdf80eb9c3a519157a3f7:/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 f5dec89f..ef705053 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_utils.cpp @@ -26,14 +26,15 @@ * */ +#include "postgresql_store.h" + +#include "stg/common.h" + #include #include #include -#include "stg/common.h" -#include "postgresql_store.h" - extern volatile time_t stgTime; int POSTGRESQL_STORE::StartTransaction() const @@ -93,10 +94,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) { @@ -114,7 +115,6 @@ return 0; std::string POSTGRESQL_STORE::Int2TS(time_t ts) const { -char buf[32]; struct tm brokenTime; brokenTime.tm_wday = 0; @@ -123,6 +123,7 @@ brokenTime.tm_isdst = 0; gmtime_r(&ts, &brokenTime); +char buf[32]; strftime(buf, 32, "%Y-%m-%d %H:%M:%S", &brokenTime); return buf; @@ -160,8 +161,6 @@ if (year) else { time_t curTime = stgTime; - /*time(&curTime);*/ - localtime_r(&curTime, &brokenTime); } @@ -173,4 +172,3 @@ strftime(buf, 32, "%Y-%m-%d", &brokenTime); date = buf; } -