swift
Loading...
Searching...
No Matches
swift::misc::ITimestampWithOffsetBased Class Reference

Entity with timestamp. More...

#include <timestampbased.h>

Inheritance diagram for swift::misc::ITimestampWithOffsetBased:
[legend]

Public Types

enum  ColumnIndex { IndexOffsetMs , IndexAdjustedMsWithOffset , IndexOffsetWithUnit }
 Properties by index. More...
Public Types inherited from swift::misc::ITimestampBased
enum  ColumnIndex {
  IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms ,
  IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm ,
  IndexMSecsSinceEpoch
}
 Properties by index. More...

Public Member Functions

void setTimeOffsetMs (qint64 offset)
 Milliseconds to add to timestamp for interpolation.
qint64 getTimeOffsetMs () const
 Milliseconds to add to timestamp for interpolation.
bool hasNonZeroOffsetTime () const
 Having a valid offset time.
void addMsecsToOffsetTime (qint64 msToAdd)
 Adds a value to offset time.
QString getTimeOffsetWithUnit () const
 Offset with unit.
qint64 getAdjustedMSecsSinceEpoch () const
 Timestamp with offset added for interpolation.
void setAdjustedMSecsSinceEpoch (qint64 adjustedTimeMs)
 Set timestamp with offset added for interpolation.
qint64 getAdjustedTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms (this -> compare).
QString getTimestampAndOffset (bool formatted) const
 Timestamp and offset.
QString getFormattedTimestampAndOffset (bool includeRawTimestamp) const
 Timestamp and offset.
bool isNewerThanAdjusted (const ITimestampWithOffsetBased &otherTimestampObj) const
 Is this newer than other?
bool isNewerThanAdjusted (qint64 mSecsSinceEpoch) const
 Is newer than epoch value?
bool isOlderThanAdjusted (const ITimestampWithOffsetBased &otherTimestampObj) const
 Is this older than other?
bool isOlderThanAdjusted (qint64 mSecsSinceEpoch) const
 Is this older than other?
Public Member Functions inherited from swift::misc::ITimestampBased
QDateTime getUtcTimestamp () const
 Get timestamp.
qint64 getMSecsSinceEpoch () const
 Timestamp as ms value.
qint64 getTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
qint64 getTimeDifferenceAbsMs (qint64 compareTime) const
 Time difference in ms.
qint64 getTimeDifferenceToNowMs () const
 Time difference to now.
qint64 getTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
qint64 getAbsTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
qint64 getAbsTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
void setTimestampToNull ()
 Set to null.
void setMSecsSinceEpoch (qint64 mSecsSinceEpoch)
 Timestamp as ms value.
void setByYearMonthDayHourMinute (const QString &yyyyMMddhhmmss)
 Set by value such as "20141003231045".
void setUtcTimestamp (const QDateTime &timestamp)
 Set timestamp.
bool isNewerThan (const ITimestampBased &otherTimestampObj) const
 Is this newer than other?
bool isNewerThan (qint64 mSecsSinceEpoch) const
 Is newer than epoch value?
bool isOlderThan (const ITimestampBased &otherTimestampObj) const
 Is this older than other?
bool isOlderThan (qint64 mSecsSinceEpoch) const
 Is this older than other?
bool isOlderThanNowMinusOffset (int offsetMs) const
 Older than now-offset.
bool isSame (const ITimestampBased &otherTimestampObj) const
 Same timestamp.
qint64 msecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
qint64 absMsecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
qint64 msecsToNow () const
 Milliseconds to now.
void setCurrentUtcTime ()
 Set the current time as timestamp.
void addMsecs (qint64 ms)
 Add the given number of milliseconds to the timestamp.
QString getFormattedUtcTimestampHms () const
 As hh:mm:ss.
QString getFormattedUtcTimestampHmsz () const
 As hh:mm:ss.zzz.
QString getFormattedUtcTimestampHm () const
 As hh:mm.
QString getFormattedUtcTimestampDhms () const
 As dd HH mm ss.
QString getFormattedUtcTimestampMdhms () const
 As MM dd HH mm ss.
QString getFormattedUtcTimestampMdhmsz () const
 As MM dd HH mm ss.zzz.
QString getFormattedUtcTimestampYmdhms () const
 As yyyy MM dd HH mm ss.
QString getFormattedUtcTimestampYmdhmsz () const
 As yyyy MM dd HH mm ss.zzz.
bool hasValidTimestamp () const
 Valid timestamp?

Protected Member Functions

 ITimestampWithOffsetBased ()=default
 Constructor.
 ITimestampWithOffsetBased (qint64 msSincePoch)
 Constructor.
 ITimestampWithOffsetBased (const QDateTime &timestamp)
 Constructor.
QVariant propertyByIndex (swift::misc::CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const
 Compare for index.
Protected Member Functions inherited from swift::misc::ITimestampBased
 ITimestampBased ()=default
 Constructor.
 ITimestampBased (qint64 msSincePoch)
 Constructor.
 ITimestampBased (const QDateTime &timestamp)
 Constructor.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const
 Compare for index.
void updateMissingParts (const ITimestampBased &other)
 Update missing parts.

Static Protected Member Functions

static bool canHandleIndex (CPropertyIndexRef index)
 Can given index be handled.

Protected Attributes

qint64 m_timeOffsetMs = 0
 offset time in ms
Protected Attributes inherited from swift::misc::ITimestampBased
qint64 m_timestampMSecsSinceEpoch = -1
 timestamp value

Additional Inherited Members

Static Public Member Functions inherited from swift::misc::ITimestampBased
static bool isAnyTimestampIndex (int index)
 Any of the timestamp indexes.
static bool canHandleIndex (CPropertyIndexRef index)
 Can given index be handled.

Detailed Description

Entity with timestamp.

Definition at line 177 of file timestampbased.h.

Member Enumeration Documentation

◆ ColumnIndex

Properties by index.

Definition at line 181 of file timestampbased.h.

Constructor & Destructor Documentation

◆ ITimestampWithOffsetBased() [1/2]

swift::misc::ITimestampWithOffsetBased::ITimestampWithOffsetBased ( qint64 msSincePoch)
inlineprotected

Constructor.

Definition at line 245 of file timestampbased.h.

◆ ITimestampWithOffsetBased() [2/2]

swift::misc::ITimestampWithOffsetBased::ITimestampWithOffsetBased ( const QDateTime & timestamp)
inlineprotected

Constructor.

Definition at line 248 of file timestampbased.h.

Member Function Documentation

◆ addMsecsToOffsetTime()

void swift::misc::ITimestampWithOffsetBased::addMsecsToOffsetTime ( qint64 msToAdd)

Adds a value to offset time.

Definition at line 290 of file timestampbased.cpp.

◆ canHandleIndex()

bool swift::misc::ITimestampWithOffsetBased::canHandleIndex ( CPropertyIndexRef index)
staticprotected

Can given index be handled.

Definition at line 274 of file timestampbased.cpp.

◆ comparePropertyByIndex()

int swift::misc::ITimestampWithOffsetBased::comparePropertyByIndex ( CPropertyIndexRef index,
const ITimestampWithOffsetBased & compareValue ) const
protected

Compare for index.

Definition at line 354 of file timestampbased.cpp.

◆ getAdjustedMSecsSinceEpoch()

qint64 swift::misc::ITimestampWithOffsetBased::getAdjustedMSecsSinceEpoch ( ) const
inline

Timestamp with offset added for interpolation.

Definition at line 205 of file timestampbased.h.

◆ getAdjustedTimeDifferenceMs()

qint64 swift::misc::ITimestampWithOffsetBased::getAdjustedTimeDifferenceMs ( qint64 compareTime) const
inline

Time difference in ms (this -> compare).

Definition at line 214 of file timestampbased.h.

◆ getFormattedTimestampAndOffset()

QString swift::misc::ITimestampWithOffsetBased::getFormattedTimestampAndOffset ( bool includeRawTimestamp) const

Timestamp and offset.

Definition at line 238 of file timestampbased.cpp.

◆ getTimeOffsetMs()

qint64 swift::misc::ITimestampWithOffsetBased::getTimeOffsetMs ( ) const
inline

Milliseconds to add to timestamp for interpolation.

Definition at line 193 of file timestampbased.h.

◆ getTimeOffsetWithUnit()

QString swift::misc::ITimestampWithOffsetBased::getTimeOffsetWithUnit ( ) const

Offset with unit.

Definition at line 292 of file timestampbased.cpp.

◆ getTimestampAndOffset()

QString swift::misc::ITimestampWithOffsetBased::getTimestampAndOffset ( bool formatted) const

Timestamp and offset.

Definition at line 224 of file timestampbased.cpp.

◆ hasNonZeroOffsetTime()

bool swift::misc::ITimestampWithOffsetBased::hasNonZeroOffsetTime ( ) const

Having a valid offset time.

Definition at line 288 of file timestampbased.cpp.

◆ isNewerThanAdjusted() [1/2]

bool swift::misc::ITimestampWithOffsetBased::isNewerThanAdjusted ( const ITimestampWithOffsetBased & otherTimestampObj) const

Is this newer than other?

Definition at line 254 of file timestampbased.cpp.

◆ isNewerThanAdjusted() [2/2]

bool swift::misc::ITimestampWithOffsetBased::isNewerThanAdjusted ( qint64 mSecsSinceEpoch) const

Is newer than epoch value?

Definition at line 259 of file timestampbased.cpp.

◆ isOlderThanAdjusted() [1/2]

bool swift::misc::ITimestampWithOffsetBased::isOlderThanAdjusted ( const ITimestampWithOffsetBased & otherTimestampObj) const

Is this older than other?

Definition at line 264 of file timestampbased.cpp.

◆ isOlderThanAdjusted() [2/2]

bool swift::misc::ITimestampWithOffsetBased::isOlderThanAdjusted ( qint64 mSecsSinceEpoch) const

Is this older than other?

Definition at line 269 of file timestampbased.cpp.

◆ propertyByIndex()

QVariant swift::misc::ITimestampWithOffsetBased::propertyByIndex ( swift::misc::CPropertyIndexRef index) const
protected

Property by index.

Definition at line 297 of file timestampbased.cpp.

◆ setAdjustedMSecsSinceEpoch()

void swift::misc::ITimestampWithOffsetBased::setAdjustedMSecsSinceEpoch ( qint64 adjustedTimeMs)
inline

Set timestamp with offset added for interpolation.

Definition at line 208 of file timestampbased.h.

◆ setPropertyByIndex()

void swift::misc::ITimestampWithOffsetBased::setPropertyByIndex ( swift::misc::CPropertyIndexRef index,
const QVariant & variant )
protected

Set property by index.

Definition at line 328 of file timestampbased.cpp.

◆ setTimeOffsetMs()

void swift::misc::ITimestampWithOffsetBased::setTimeOffsetMs ( qint64 offset)
inline

Milliseconds to add to timestamp for interpolation.

Definition at line 190 of file timestampbased.h.

Member Data Documentation

◆ m_timeOffsetMs

qint64 swift::misc::ITimestampWithOffsetBased::m_timeOffsetMs = 0
protected

offset time in ms

Definition at line 259 of file timestampbased.h.


The documentation for this class was generated from the following files: