#ifndef __RKT_UTILS_H__
#define __RKT_UTILS_H__

#include <QHash>
#include <QString>
#include <QVariant>
#include <QDateTime>

class EventContainer : public QHash<QString, QVariant>
{
private:
    static int evt_count;
    static qint64 ms_start;
public:
    EventContainer(const QString &evt) {
        if (ms_start < 0) {
            ms_start = QDateTime::currentMSecsSinceEpoch();
        }
        this->insert("event", evt);
        this->insert("evt-id", ++evt_count);

        qint64 ms = QDateTime::currentMSecsSinceEpoch();
        this->insert("timestamp", ms);
        this->insert("elaped", static_cast<double>(ms - ms_start) / 1000.0);
    }
};

QString mkEventJson(const EventContainer &kv);




#endif
