Beispiel #1
0
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();
}
Beispiel #2
0
		// Returns number of seconds eta for the torrent
		inline boost::int64_t getEta()
		{
			return (getDownloadRate() <= 0) ? -1 : (getWanted() / getDownloadRate());
		}
Beispiel #3
0
		// Returns a friendly string for the current download rate
		inline std::string getTextDownloadRate()
		{
			return getRateString(getDownloadRate());
		}
Beispiel #4
0
		//Returns the elapsed time remaining in seconds
		inline boost::int64_t getTimeRemaining()
		{
			return (getDownloadRate() > 0) ? getTorrentSize() / getDownloadRate() : 0;
		}
Beispiel #5
0
std::string gt::Torrent::getTextDownloadRate()
{
	return getRateString(getDownloadRate());
}
Beispiel #6
0
int64_t gt::Torrent::getTimeRemaining()
{
	return (getDownloadRate() > 0) ? getSize() / getDownloadRate() : 0;
}
Beispiel #7
0
// Returns number of seconds eta for the torrent
int64_t gt::Torrent::getEta()
{
	return (getDownloadRate() <= 0) ? -1 : (getSize() / getDownloadRate());
}