Set session level time zone for Postgres DB connection so that all time-aware timestamps are returned in 'UTC' rather than configured time zone
@@ -350,6 +350,14 @@ Connection::Connection()
connectErrorTime = time(0);
}
}
+
+ logSQL("Set", "session time zone 'UTC' ");
+ PGresult *res = PQexec(dbConnection, " set session time zone 'UTC' ");
+ if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ {
+ Logger::getLogger()->error("set session time zone failed: %s", PQerrorMessage(dbConnection));
+ }
+ PQclear(res);
}
/**
