20 : m_timestampMSecsSinceEpoch(timestamp.toMSecsSinceEpoch())
69 if (offsetMs <= 0) {
return false; }
85 qint64 dt = this->
msecsTo(otherTimestampObj);
86 return dt > 0 ? dt : dt * -1;
143 return (index >=
static_cast<int>(IndexUtcTimestamp)) && (index <= static_cast<int>(IndexMSecsSinceEpoch));
148 if (index.
isEmpty()) {
return false; }
160 case IndexUtcTimestamp:
return QVariant::fromValue(this->
getUtcTimestamp());
172 const QString m = QStringLiteral(
"Cannot handle index %1").arg(index.
toQString());
174 return QVariant::fromValue(m);
184 case IndexUtcTimestamp: this->
setUtcTimestamp(variant.toDateTime());
return;
186 case IndexUtcTimestampFormattedYmdhms:
187 case IndexUtcTimestampFormattedYmdhmsz:
188 case IndexUtcTimestampFormattedHm:
189 case IndexUtcTimestampFormattedHms:
190 case IndexUtcTimestampFormattedDhms:
199 const QString m = QStringLiteral(
"Cannot handle index %1").arg(index.
toQString());
216 static const QString ts(
"%1 (%2)");
225 static const QString ts(
"%1/%2 (%3)");
255 if (index.
isEmpty()) {
return false; }
257 return (i >=
static_cast<int>(IndexOffsetMs)) && (i <=
static_cast<int>(IndexOffsetWithUnit));
281 case IndexAdjustedMsWithOffset:
285 case IndexOffsetWithUnit:
292 const QString m = QStringLiteral(
"Cannot handle index %1").arg(index.
toQString());
314 case IndexAdjustedMsWithOffset:
return;
315 case IndexOffsetWithUnit:
return;
319 const QString m = QStringLiteral(
"Cannot handle index %1").arg(index.
toQString());
335 case IndexOffsetWithUnit:
340 case IndexAdjustedMsWithOffset:
347 const QString m = QStringLiteral(
"Cannot handle index %1").arg(index.
toQString());
Non-owning reference to a CPropertyIndex with a subset of its features.
QString toQString(bool i18n=false) const
Cast as QString.
bool isEmpty() const
Empty?
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
qint64 getMSecsSinceEpoch() const
Timestamp as ms value.
bool isNewerThan(const ITimestampBased &otherTimestampObj) const
Is this newer than other?
bool isOlderThanNowMinusOffset(int offsetMs) const
Older than now-offset.
static bool isAnyTimestampIndex(int index)
Any of the timestamp indexes.
void updateMissingParts(const ITimestampBased &other)
Update missing parts.
ITimestampBased()
Constructor.
void setTimestampToNull()
Set to null.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampBased &compareValue) const
Compare for index.
QString getFormattedUtcTimestampYmdhms() const
As yyyy MM dd HH mm ss.
void setByYearMonthDayHourMinute(const QString &yyyyMMddhhmmss)
Set by value such as "20141003231045".
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
QString getFormattedUtcTimestampHmsz() const
As hh:mm:ss.zzz.
qint64 m_timestampMSecsSinceEpoch
timestamp value
void setCurrentUtcTime()
Set the current time as timestamp.
QString getFormattedUtcTimestampHm() const
As hh:mm.
QDateTime getUtcTimestamp() const
Get timestamp.
bool isOlderThan(const ITimestampBased &otherTimestampObj) const
Is this older than other?
QString getFormattedUtcTimestampHms() const
As hh:mm:ss.
ColumnIndex
Properties by index.
qint64 msecsToNow() const
Milliseconds to now.
bool isSame(const ITimestampBased &otherTimestampObj) const
Same timestamp.
QString getFormattedUtcTimestampMdhms() const
As MM dd HH mm ss.
QString getFormattedUtcTimestampDhms() const
As dd HH mm ss.
void setUtcTimestamp(const QDateTime ×tamp)
Set timestamp.
bool hasValidTimestamp() const
Valid timestamp?
qint64 msecsTo(const ITimestampBased &otherTimestampObj) const
Time difference.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString getFormattedUtcTimestampYmdhmsz() const
As yyyy MM dd HH mm ss.zzz.
qint64 absMsecsTo(const ITimestampBased &otherTimestampObj) const
Time difference.
QString getFormattedUtcTimestampMdhmsz() const
As MM dd HH mm ss.zzz.
void setMSecsSinceEpoch(qint64 mSecsSinceEpoch)
Timestamp as ms value.
void addMsecs(qint64 ms)
Add the given number of milliseconds to the timestamp.
qint64 getAdjustedMSecsSinceEpoch() const
Timestamp with offset added for interpolation.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
QString getTimeOffsetWithUnit() const
Offset with unit.
qint64 getTimeOffsetMs() const
Milliseconds to add to timestamp for interpolation.
int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const
Compare for index.
qint64 m_timeOffsetMs
offset time in ms
bool hasNonZeroOffsetTime() const
Having a valid offset time.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
bool isNewerThanAdjusted(const ITimestampWithOffsetBased &otherTimestampObj) const
Is this newer than other?
QString getTimestampAndOffset(bool formatted) const
Timestamp and offset.
bool isOlderThanAdjusted(const ITimestampWithOffsetBased &otherTimestampObj) const
Is this older than other?
void addMsecsToOffsetTime(qint64 msToAdd)
Adds a value to offset time.
QString getFormattedTimestampAndOffset(bool includeRawTimestamp) const
Timestamp and offset.
Free functions in swift::misc.
SWIFT_MISC_EXPORT QString removeDateTimeSeparators(const QString &s)
Remove the typical separators such as "-", " ".
SWIFT_MISC_EXPORT QDateTime fromStringUtc(const QString &dateTimeString, const QString &format)
Same as QDateTime::fromString but QDateTime will be set to UTC.
SWIFT_MISC_EXPORT QDateTime parseDateTimeStringOptimized(const QString &dateTimeString)
Parse yyyyMMddHHmmsszzz strings optimized.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.