#include "tariff_comp_step.h" #include <QByteArray> #include <QCryptographicHash> #include <QString> uint64_t TariffCompStep::hash() { QString const str(QString("%1%2%3").arg(m_duration).arg(m_start.toString(Qt::ISODate)).arg(m_end.toString(Qt::ISODate))); QByteArray const hash = QCryptographicHash::hash( QByteArray::fromRawData(reinterpret_cast<char const*>(str.utf16()), str.length()*2), QCryptographicHash::Md5 ); uint64_t const &i = hash.left(8).toULongLong(nullptr, 16); uint64_t const &j = hash.right(8).toULongLong(nullptr, 16); return i ^ j; }