diff --git a/src/core/utils.cpp b/src/core/utils.cpp index 5346bd4..3ba7122 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -1,51 +1,48 @@ /* * This file is part of LibKGAPI library * * Copyright (C) 2013 Daniel Vrátil * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include "utils.h" #include KGAPI2::ContentType Utils::stringToContentType(const QString& contentType) { if (contentType.contains(QLatin1String("application/json")) || contentType.contains(QLatin1String("text/plain")) || contentType.contains(QLatin1String("text/javascript"))) { return KGAPI2::JSON; } else if (contentType.contains(QLatin1String("application/atom+xml")) || contentType.contains(QLatin1String("text/xml"))) { return KGAPI2::XML; } return KGAPI2::UnknownContentType; } QString Utils::bool2Str(bool val) { return (val ? QStringLiteral("true") : QStringLiteral("false")); } QString Utils::ts2Str(quint64 ts) { - QDateTime dt; - dt.setTime_t(ts); - dt.setTimeSpec(Qt::UTC); - return dt.toString(Qt::ISODate); + return QDateTime::fromTime_t(ts, Qt::UTC, 0).toString(Qt::ISODate); }