diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-05-10 01:53:32 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-06-09 01:38:30 +0200 |
commit | 92abe4c603e1f4931cd02ae6b752cb7054d8e30d (patch) | |
tree | 571c6bc638b474af7e44f4db626f15e301286a65 /logic/minecraft/ParseUtils.cpp | |
parent | 9860d5ee12acde8f7893848dac53f59ea66da281 (diff) | |
download | MultiMC-92abe4c603e1f4931cd02ae6b752cb7054d8e30d.tar MultiMC-92abe4c603e1f4931cd02ae6b752cb7054d8e30d.tar.gz MultiMC-92abe4c603e1f4931cd02ae6b752cb7054d8e30d.tar.lz MultiMC-92abe4c603e1f4931cd02ae6b752cb7054d8e30d.tar.xz MultiMC-92abe4c603e1f4931cd02ae6b752cb7054d8e30d.zip |
All of the broken legacy things work.
Diffstat (limited to 'logic/minecraft/ParseUtils.cpp')
-rw-r--r-- | logic/minecraft/ParseUtils.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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 <QDateTime> +#include <QString> +#include "ParseUtils.h" +#include <logic/MMCJson.h> + +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!"); + } +} |