sneedmc/logic/minecraft/ParseUtils.cpp

25 lines
447 B
C++
Raw Normal View History

2014-05-09 23:53:32 +00:00
#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)
2014-05-09 23:53:32 +00:00
{
save_here = raw;
if (save_here.isEmpty())
{
return false;
2014-05-09 23:53:32 +00:00
}
parse_here = timeFromS3Time(save_here);
if (!parse_here.isValid())
{
return false;
2014-05-09 23:53:32 +00:00
}
return true;
2014-05-09 23:53:32 +00:00
}