string Torrent::getTextDownloadRate() { std::ostringstream dnr; long double downrate = getDownloadRate() / 1024; if (downrate <= 0) { dnr << string(); } else if (downrate > 0 && downrate < 1024) { dnr << downrate << " KB/s"; } else if (downrate >= 1024 && downrate < (1024 * 1024)) { dnr << fixed << setprecision(3) << (downrate / 1024) << " MB/s"; } else if (downrate >= (1024 * 1024) && downrate < (1024 * 1024)) { dnr << fixed << setprecision(3) << (downrate / 1024 / 1024) << " GB/s"; } else if (downrate >= (1024 * 1024 * 1024)) { dnr << fixed << setprecision(3) << (downrate / 1024 / 1024 / 1024) << " sanic/s"; } return dnr.str(); }
// Returns number of seconds eta for the torrent inline boost::int64_t getEta() { return (getDownloadRate() <= 0) ? -1 : (getWanted() / getDownloadRate()); }
// Returns a friendly string for the current download rate inline std::string getTextDownloadRate() { return getRateString(getDownloadRate()); }
//Returns the elapsed time remaining in seconds inline boost::int64_t getTimeRemaining() { return (getDownloadRate() > 0) ? getTorrentSize() / getDownloadRate() : 0; }
std::string gt::Torrent::getTextDownloadRate() { return getRateString(getDownloadRate()); }
int64_t gt::Torrent::getTimeRemaining() { return (getDownloadRate() > 0) ? getSize() / getDownloadRate() : 0; }
// Returns number of seconds eta for the torrent int64_t gt::Torrent::getEta() { return (getDownloadRate() <= 0) ? -1 : (getSize() / getDownloadRate()); }