Avoid repeatedly creating the same QDateTime values

PR #21904.
This commit is contained in:
Vladimir Golovnev
2024-11-26 09:04:59 +03:00
committed by Vladimir Golovnev (Glassez)
parent ad3348b95f
commit dbfd830b56
9 changed files with 115 additions and 83 deletions

View File

@@ -1606,7 +1606,7 @@ void SessionImpl::endStartup(ResumeSessionContext *context)
reannounceToAllTrackers();
}
m_wakeupCheckTimestamp = QDateTime::currentDateTime();
m_wakeupCheckTimestamp = now;
});
m_wakeupCheckTimestamp = QDateTime::currentDateTime();
m_wakeupCheckTimer->start(30s);
@@ -6363,7 +6363,7 @@ void SessionImpl::handleRemovedTorrent(const TorrentID &torrentID, const QString
m_removingTorrents.erase(removingTorrentDataIter);
}
QDateTime SessionImpl::fromLTTimePoint32(const libtorrent::time_point32 &timePoint) const
QDateTime SessionImpl::fromLTTimePoint32(const lt::time_point32 &timePoint) const
{
const auto secsSinceNow = lt::duration_cast<lt::seconds>(timePoint - m_ltNow + lt::milliseconds(500)).count();
return m_qNow.addSecs(secsSinceNow);