diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index af877772..b6a5f864 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -273,8 +273,10 @@ namespace torrents { "totalSize", [](std::shared_ptr torrent) { return boost::json::value(torrent->GetLength ()); } }, { "percentDone", [](std::shared_ptr torrent) { - if(!torrent->GetLength()) return boost::json::value ( 100 ); - return boost::json::value( (torrent->GetLength () - torrent->GetLeft ())*100/torrent->GetLength () ); + if(!torrent->GetLength()) return boost::json::value ( 100.0 ); + double left = torrent->GetLength () - torrent->GetLeft(); + double percent = (left*100)/torrent->GetLength(); + return boost::json::value( percent ); } }, { "hashString", [](std::shared_ptr torrent)