summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-05-08 17:25:46 -0500
committerAndrew <forkk@forkk.net>2013-05-08 17:25:46 -0500
commit159404f444316340c7eba3eecfafaa46842f5783 (patch)
treef72958369658c1310522584cc57919cbf84921ec
parent5f781b3053c5ba8a25d354903acf2c31dc9a56c5 (diff)
downloadMultiMC-159404f444316340c7eba3eecfafaa46842f5783.tar
MultiMC-159404f444316340c7eba3eecfafaa46842f5783.tar.gz
MultiMC-159404f444316340c7eba3eecfafaa46842f5783.tar.lz
MultiMC-159404f444316340c7eba3eecfafaa46842f5783.tar.xz
MultiMC-159404f444316340c7eba3eecfafaa46842f5783.zip
Fixed timestamp parsing in version lists.
-rw-r--r--libmultimc/src/minecraftversionlist.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/libmultimc/src/minecraftversionlist.cpp b/libmultimc/src/minecraftversionlist.cpp
index 8b40069e..04c4f918 100644
--- a/libmultimc/src/minecraftversionlist.cpp
+++ b/libmultimc/src/minecraftversionlist.cpp
@@ -152,24 +152,7 @@ inline QDomElement getDomElementByTagName(QDomElement parent, QString tagname)
inline QDateTime timeFromS3Time(QString str)
{
- const QString fmt("yyyy-MM-dd'T'HH:mm:ss'.000Z'");
- return QDateTime::fromString(str, fmt);
-}
-
-inline QDateTime timeFromMCVListTime(QString str)
-{
- int operatorPos = str.indexOf("+", str.indexOf("T"));
- if (operatorPos == -1)
- operatorPos = str.indexOf("-", str.indexOf("T"));
- if (operatorPos)
- operatorPos = str.length();
-
- const QString fmt("yyyy-MM-dd'T'HH:mm:ss'+02:00'");
-
- // It's a dark templar!
- QDateTime dt = QDateTime::fromString(str.left(operatorPos), fmt);
- return dt;
-
+ return QDateTime::fromString(str, Qt::ISODate);
}
@@ -257,7 +240,7 @@ bool MCVListLoadTask::loadFromVList()
QJsonObject version = versions[i].toObject();
QString versionID = version.value("id").toString("");
- QString versionTimeStr = version.value("time").toString("");
+ QString versionTimeStr = version.value("releaseTime").toString("");
QString versionTypeStr = version.value("type").toString("");
Q_ASSERT_X(!versionID.isEmpty(), "loadFromVList",
@@ -274,7 +257,7 @@ bool MCVListLoadTask::loadFromVList()
// Now, process that info and add the version to the list.
// Parse the timestamp.
- QDateTime versionTime = timeFromMCVListTime(versionTimeStr);
+ QDateTime versionTime = timeFromS3Time(versionTimeStr);
Q_ASSERT_X(versionTime.isValid(), "loadFromVList",
QString("in versions array, index %1's timestamp failed to parse").