summaryrefslogtreecommitdiffstats
path: root/tests/hawd/dataset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hawd/dataset.cpp')
-rw-r--r--tests/hawd/dataset.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp
index 62fa0d7..3325850 100644
--- a/tests/hawd/dataset.cpp
+++ b/tests/hawd/dataset.cpp
@@ -31,6 +31,7 @@ namespace HAWD
31 31
32static const QString s_annotationKey("__annotation__"); 32static const QString s_annotationKey("__annotation__");
33static const QString s_hashKey("__commithash__"); 33static const QString s_hashKey("__commithash__");
34static const QString s_timestampKey("__timestamp");
34static const int s_fieldWidth(20); 35static const int s_fieldWidth(20);
35 36
36Dataset::Row::Row(const Row &other) 37Dataset::Row::Row(const Row &other)
@@ -118,6 +119,8 @@ void Dataset::Row::fromBinary(QByteArray data)
118 m_annotation = value.toString(); 119 m_annotation = value.toString();
119 } else if (key == s_hashKey) { 120 } else if (key == s_hashKey) {
120 m_commitHash = value.toString(); 121 m_commitHash = value.toString();
122 } else if (key == s_timestampKey) {
123 m_timeStamp = value.toDateTime();
121 } else { 124 } else {
122 setValue(key, value); 125 setValue(key, value);
123 } 126 }
@@ -141,6 +144,10 @@ QByteArray Dataset::Row::toBinary() const
141 stream << s_hashKey << QVariant(m_commitHash); 144 stream << s_hashKey << QVariant(m_commitHash);
142 } 145 }
143 146
147 if (!m_timeStamp.isValid()) {
148 stream << s_timestampKey << QVariant(m_timeStamp);
149 }
150
144 if (!m_annotation.isEmpty()) { 151 if (!m_annotation.isEmpty()) {
145 stream << s_annotationKey << QVariant(m_annotation); 152 stream << s_annotationKey << QVariant(m_annotation);
146 } 153 }
@@ -189,11 +196,19 @@ QString Dataset::Row::commitHash() const
189 196
190QDateTime Dataset::Row::timestamp() const 197QDateTime Dataset::Row::timestamp() const
191{ 198{
199 if (m_timeStamp.isValid()) {
200 return m_timeStamp;
201 }
192 QDateTime dt; 202 QDateTime dt;
193 dt.setMSecsSinceEpoch(m_key); 203 dt.setMSecsSinceEpoch(m_key);
194 return dt; 204 return dt;
195} 205}
196 206
207void Dataset::Row::setTimestamp(const QDateTime &dt)
208{
209 m_timeStamp = dt;
210}
211
197QString Dataset::Row::toString(const QStringList &cols, int standardCols, const QString &seperator) const 212QString Dataset::Row::toString(const QStringList &cols, int standardCols, const QString &seperator) const
198{ 213{
199 if (m_data.isEmpty()) { 214 if (m_data.isEmpty()) {