mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +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;
|
||||
}
|
||||
|
||||
qint64 ITimestampBased::msecsToNow() const
|
||||
{
|
||||
if (this->m_timestampMSecsSinceEpoch < 0) return QDateTime::currentMSecsSinceEpoch();
|
||||
return QDateTime::currentMSecsSinceEpoch() - this->m_timestampMSecsSinceEpoch;
|
||||
}
|
||||
|
||||
void ITimestampBased::setCurrentUtcTime()
|
||||
{
|
||||
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -80,6 +80,9 @@ namespace BlackMisc
|
||||
//! Time difference
|
||||
qint64 absMsecsTo(const ITimestampBased &otherTimestampObj) const;
|
||||
|
||||
//! Milliseconds to now
|
||||
qint64 msecsToNow() const;
|
||||
|
||||
//! Set the current time as timestamp
|
||||
void setCurrentUtcTime();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user