00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TIMEDVALUE_H
00023 #define TIMEDVALUE_H
00024
00025 #include <time.h>
00026 #include <QVariant>
00027
00028 namespace ContextSubscriber {
00029
00030 struct TimedValue
00031 {
00032 quint64 time;
00033 QVariant value;
00034
00035 TimedValue() : time(0), value(QVariant())
00036 { }
00037 TimedValue(const QVariant &value, quint64 time) : time(time), value(value)
00038 { }
00039 TimedValue(const QVariant &value) : value(value)
00040 {
00041 struct timespec t;
00042 clock_gettime(CLOCK_MONOTONIC, &t);
00043 time = t.tv_sec * Q_UINT64_C(1000000000) + t.tv_nsec;
00044 }
00045 bool operator<(const TimedValue &other)
00046 {
00047 return time < other.time;
00048 }
00049 };
00050
00051 }
00052
00053 #endif