]> granicus.if.org Git - icinga2/commitdiff
Ensure that PostgreSQL timestamps are UTC
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 11 Jan 2017 16:34:09 +0000 (17:34 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 11 Jan 2017 16:34:09 +0000 (17:34 +0100)
fixes #13617

lib/db_ido_pgsql/idopgsqlconnection.cpp

index f398fda50b8733aa5fde9c29c25290db900eef11..c16f9f50f1ffcfe45118ca66204b42729fe99773 100644 (file)
@@ -636,7 +636,7 @@ bool IdoPgsqlConnection::FieldToEscapedString(const String& key, const Value& va
        } else if (DbValue::IsTimestamp(value)) {
                long ts = rawvalue;
                std::ostringstream msgbuf;
-               msgbuf << "TO_TIMESTAMP(" << ts << ")";
+               msgbuf << "TO_TIMESTAMP(" << ts << ") AT TIME ZONE 'UTC'";
                *result = Value(msgbuf.str());
        } else if (DbValue::IsTimestampNow(value)) {
                *result = "NOW()";