From 56df8c2dd0548c84ffdcd0630c08e596e242184b Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Fri, 12 Jun 2015 09:36:01 +0300 Subject: [PATCH] Fix time_t 0 special meaning. Return null QDateTime object when converting from 0 time_t value. --- src/core/bittorrent/torrenthandle.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index f2ef6a45d..f4c16bf74 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -916,12 +916,18 @@ int TorrentHandle::incompleteCount() const QDateTime TorrentHandle::lastSeenComplete() const { - return QDateTime::fromTime_t(m_nativeStatus.last_seen_complete); + if (m_nativeStatus.last_seen_complete > 0) + return QDateTime::fromTime_t(m_nativeStatus.last_seen_complete); + else + return QDateTime(); } QDateTime TorrentHandle::completedTime() const { - return QDateTime::fromTime_t(m_nativeStatus.completed_time); + if (m_nativeStatus.completed_time > 0) + return QDateTime::fromTime_t(m_nativeStatus.completed_time); + else + return QDateTime(); } int TorrentHandle::timeSinceUpload() const