summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/ParseUtils.cpp
blob: f94de6ff8b46651c88eb7fe5c440bb12d73395e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <QDateTime>
#include <QString>
#include "ParseUtils.h"
#include <logic/MMCJson.h>

QDateTime timeFromS3Time(QString str)
{
	return QDateTime::fromString(str, Qt::ISODate);
}

bool parse_timestamp (const QString & raw, QString & save_here, QDateTime & parse_here)
{
	save_here = raw;
	if (save_here.isEmpty())
	{
		return false;
	}
	parse_here = timeFromS3Time(save_here);
	if (!parse_here.isValid())
	{
		return false;
	}
	return true;
}