From 1ae8856d93f8256c650860a149edfeae4a2fc4cf Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Wed, 1 Mar 2017 14:43:10 -0500 Subject: [PATCH] more use of total_seconds --- include/libtorrent/torrent.hpp | 8 ++++---- src/torrent.cpp | 16 +++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index ce5f63a9b..56fea2fd9 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -1287,15 +1287,15 @@ namespace libtorrent // the posix time this torrent was added and when // it was completed. If the torrent isn't yet // completed, m_completed_time is 0 - time_t m_added_time = time(nullptr); - time_t m_completed_time = 0; + std::time_t m_added_time = time(nullptr); + std::time_t m_completed_time = 0; // this was the last time _we_ saw a seed in this swarm - time_t m_last_seen_complete = 0; + std::time_t m_last_seen_complete = 0; // this is the time last any of our peers saw a seed // in this swarm - time_t m_swarm_last_seen_complete = 0; + std::time_t m_swarm_last_seen_complete = 0; // keep a copy if the info-hash here, so it can be accessed from multiple // threads, and be cheap to access from the client diff --git a/src/torrent.cpp b/src/torrent.cpp index 255446719..39bb3c80a 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -5946,10 +5946,9 @@ namespace libtorrent ret["total_uploaded"] = m_total_uploaded; ret["total_downloaded"] = m_total_downloaded; - // cast to seconds in case that internal values doesn't have ratio<1> - ret["active_time"] = duration_cast(active_time()).count(); - ret["finished_time"] = duration_cast(finished_time()).count(); - ret["seeding_time"] = duration_cast(seeding_time()).count(); + ret["active_time"] = total_seconds(active_time()); + ret["finished_time"] = total_seconds(finished_time()); + ret["seeding_time"] = total_seconds(seeding_time()); ret["last_seen_complete"] = m_last_seen_complete; ret["num_complete"] = m_complete; @@ -5991,7 +5990,7 @@ namespace libtorrent } // blocks per piece - int num_blocks_per_piece = torrent_file().piece_length() / block_size(); + int const num_blocks_per_piece = torrent_file().piece_length() / block_size(); ret["blocks per piece"] = num_blocks_per_piece; if (m_torrent_file->is_merkle_torrent()) @@ -10565,10 +10564,9 @@ namespace libtorrent // activity time #ifndef TORRENT_NO_DEPRECATE - // cast to seconds in case that internal values doesn't have ratio<1> - st->finished_time = int(duration_cast(finished_time()).count()); - st->active_time = int(duration_cast(active_time()).count()); - st->seeding_time = int(duration_cast(seeding_time()).count()); + st->finished_time = int(total_seconds(finished_time())); + st->active_time = int(total_seconds(active_time())); + st->seeding_time = int(total_seconds(seeding_time())); st->time_since_upload = int(total_seconds(aux::time_now() - m_last_upload));