mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T129, utility function for timestamp based interface
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ba8d0c1f64
commit
bfa3908a99
@@ -126,6 +126,12 @@ namespace BlackMisc
|
|||||||
return dt > 0 ? dt : dt * -1;
|
return dt > 0 ? dt : dt * -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 ITimestampBased::msecsToNow() const
|
||||||
|
{
|
||||||
|
if (this->m_timestampMSecsSinceEpoch < 0) return QDateTime::currentMSecsSinceEpoch();
|
||||||
|
return QDateTime::currentMSecsSinceEpoch() - this->m_timestampMSecsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
void ITimestampBased::setCurrentUtcTime()
|
void ITimestampBased::setCurrentUtcTime()
|
||||||
{
|
{
|
||||||
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ namespace BlackMisc
|
|||||||
//! Time difference
|
//! Time difference
|
||||||
qint64 absMsecsTo(const ITimestampBased &otherTimestampObj) const;
|
qint64 absMsecsTo(const ITimestampBased &otherTimestampObj) const;
|
||||||
|
|
||||||
|
//! Milliseconds to now
|
||||||
|
qint64 msecsToNow() const;
|
||||||
|
|
||||||
//! Set the current time as timestamp
|
//! Set the current time as timestamp
|
||||||
void setCurrentUtcTime();
|
void setCurrentUtcTime();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user