Ref T292, Ref T285 function to set file timestamp

This commit is contained in:
Klaus Basan
2018-07-26 02:13:53 +02:00
parent 77f10938d9
commit 338c5b344a
4 changed files with 36 additions and 10 deletions

View File

@@ -74,14 +74,7 @@ namespace BlackMisc
void ITimestampBased::setUtcTimestamp(const QDateTime &timestamp)
{
if (timestamp.isValid())
{
m_timestampMSecsSinceEpoch = timestamp.toMSecsSinceEpoch();
}
else
{
m_timestampMSecsSinceEpoch = -1; // invalid
}
m_timestampMSecsSinceEpoch = timestamp.isValid() ? timestamp.toMSecsSinceEpoch() : -1;
}
bool ITimestampBased::isNewerThan(const ITimestampBased &otherTimestampObj) const
@@ -266,6 +259,14 @@ namespace BlackMisc
return Compare::compare(m_timestampMSecsSinceEpoch, compareValue.m_timestampMSecsSinceEpoch);
}
void ITimestampBased::updateMissingParts(const ITimestampBased &other)
{
if (m_timestampMSecsSinceEpoch < 0)
{
m_timestampMSecsSinceEpoch = other.m_timestampMSecsSinceEpoch;
}
}
QString ITimestampWithOffsetBased::getTimestampAndOffset(bool formatted) const
{
static const QString ts("%1 (%2)");