mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 16:57:55 +00:00
Handle invalid time activity properly
When there is no activity before m_nativeStatus.last_upload will be 0 and this commit will map it to -1 which retain the expected behavior as before (libtorrent < 1.2 era).
This commit is contained in:
parent
9b611a6207
commit
bbecf87292
@ -1136,6 +1136,8 @@ qlonglong TorrentHandle::timeSinceUpload() const
|
|||||||
#if (LIBTORRENT_VERSION_NUM < 10200)
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
return m_nativeStatus.time_since_upload;
|
return m_nativeStatus.time_since_upload;
|
||||||
#else
|
#else
|
||||||
|
if (m_nativeStatus.last_upload.time_since_epoch().count() == 0)
|
||||||
|
return -1;
|
||||||
return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_upload);
|
return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_upload);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1145,6 +1147,8 @@ qlonglong TorrentHandle::timeSinceDownload() const
|
|||||||
#if (LIBTORRENT_VERSION_NUM < 10200)
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
return m_nativeStatus.time_since_download;
|
return m_nativeStatus.time_since_download;
|
||||||
#else
|
#else
|
||||||
|
if (m_nativeStatus.last_download.time_since_epoch().count() == 0)
|
||||||
|
return -1;
|
||||||
return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_download);
|
return lt::total_seconds(lt::clock_type::now() - m_nativeStatus.last_download);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user