Merge pull request #46 from johnzhanghua/master

timestamp in AMQP-0-9-1 should be seconds other than milliseconds
This commit is contained in:
Matt Broadstone 2016-05-25 22:31:38 -04:00
commit 3b2a853707
2 changed files with 3 additions and 3 deletions

View File

@ -202,7 +202,7 @@ QVariant QAmqpFrame::readAmqpField(QDataStream &s, QAmqpMetaType::ValueType type
{ {
qulonglong tmp_value; qulonglong tmp_value;
s >> tmp_value; s >> tmp_value;
return QDateTime::fromMSecsSinceEpoch(tmp_value); return QDateTime::fromTime_t(tmp_value);
} }
case QAmqpMetaType::Hash: case QAmqpMetaType::Hash:
{ {
@ -256,7 +256,7 @@ void QAmqpFrame::writeAmqpField(QDataStream &s, QAmqpMetaType::ValueType type, c
} }
break; break;
case QAmqpMetaType::Timestamp: case QAmqpMetaType::Timestamp:
s << qulonglong(value.toDateTime().toMSecsSinceEpoch()); s << qulonglong(value.toDateTime().toTime_t());
break; break;
case QAmqpMetaType::Hash: case QAmqpMetaType::Hash:
{ {

View File

@ -560,7 +560,7 @@ void tst_QAMQPQueue::tableFieldDataTypes()
array.append(true); array.append(true);
array.append(qint32(-65536)); array.append(qint32(-65536));
QDateTime timestamp = QDateTime::currentDateTime(); QDateTime timestamp = QDateTime::currentDateTime().toTime_t();
QAmqpTable headers; QAmqpTable headers;
headers.insert("boolean", true); headers.insert("boolean", true);