more use of total_seconds

This commit is contained in:
Alden Torres 2017-03-01 14:43:10 -05:00 committed by Arvid Norberg
parent b03943429f
commit 1ae8856d93
2 changed files with 11 additions and 13 deletions

View File

@ -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

View File

@ -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<seconds>(active_time()).count();
ret["finished_time"] = duration_cast<seconds>(finished_time()).count();
ret["seeding_time"] = duration_cast<seconds>(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<seconds>(finished_time()).count());
st->active_time = int(duration_cast<seconds>(active_time()).count());
st->seeding_time = int(duration_cast<seconds>(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));