Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
Signed-off-by: Date Huang <[email protected]>
  • Loading branch information
tjjh89017 committed Mar 29, 2024
1 parent ed75279 commit 1a9f782
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,15 @@ std::map<std::string, torrent_status> ezio::get_torrent_status(std::vector<std::
status.is_paused = (t_stat.flags & libtorrent::torrent_flags::paused) != 0;
status.save_path = t_stat.save_path;

status.last_upload = std::chrono::duration_cast<std::chrono::seconds>(now - t_stat.last_upload).count();
status.last_download = std::chrono::duration_cast<std::chrono::seconds>(now - t_stat.last_download).count();
status.last_upload = -1;
if (t_stat.last_upload.time_since_epoch().count() != 0) {
status.last_upload = std::chrono::duration_cast<std::chrono::seconds>(now - t_stat.last_upload).count();
}

status.last_download = -1;
if (t_stat.last_download.time_since_epoch().count() != 0) {
status.last_download = std::chrono::duration_cast<std::chrono::seconds>(now - t_stat.last_download).count();
}

result.emplace(hash, status);
}
Expand Down

0 comments on commit 1a9f782

Please sign in to comment.