From 92abe4c603e1f4931cd02ae6b752cb7054d8e30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 10 May 2014 01:53:32 +0200 Subject: All of the broken legacy things work. --- logic/minecraft/ParseUtils.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 logic/minecraft/ParseUtils.cpp (limited to 'logic/minecraft/ParseUtils.cpp') diff --git a/logic/minecraft/ParseUtils.cpp b/logic/minecraft/ParseUtils.cpp new file mode 100644 index 00000000..67460ca4 --- /dev/null +++ b/logic/minecraft/ParseUtils.cpp @@ -0,0 +1,23 @@ +#include +#include +#include "ParseUtils.h" +#include + +QDateTime timeFromS3Time(QString str) +{ + return QDateTime::fromString(str, Qt::ISODate); +} + +void parse_timestamp (const QString & raw, QString & save_here, QDateTime & parse_here) +{ + save_here = raw; + if (save_here.isEmpty()) + { + throw JSONValidationError("The timestamp is empty!"); + } + parse_here = timeFromS3Time(save_here); + if (!parse_here.isValid()) + { + throw JSONValidationError("The timestamp not a valid timestamp!"); + } +} -- cgit v1.2.3