From fba72f5fb77bfc45762a44f23508118a283383ac Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 21 Aug 2019 17:43:55 +0800 Subject: [PATCH] Simplify code --- src/webui/api/serialize/serialize_torrent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webui/api/serialize/serialize_torrent.cpp b/src/webui/api/serialize/serialize_torrent.cpp index 4f3423fff..14c7935bc 100644 --- a/src/webui/api/serialize/serialize_torrent.cpp +++ b/src/webui/api/serialize/serialize_torrent.cpp @@ -136,9 +136,9 @@ QVariantMap serialize(const BitTorrent::TorrentHandle &torrent) ret[KEY_TORRENT_LAST_ACTIVITY_TIME] = 0; } else { - QDateTime dt = QDateTime::currentDateTime(); - dt = dt.addSecs(-torrent.timeSinceActivity()); - ret[KEY_TORRENT_LAST_ACTIVITY_TIME] = dt.toSecsSinceEpoch(); + const qint64 dt = (QDateTime::currentDateTime().toSecsSinceEpoch() + - torrent.timeSinceActivity()); + ret[KEY_TORRENT_LAST_ACTIVITY_TIME] = dt; } return ret;