Closed fuyukaidesu closed 10 years ago
Issue by benwaffle Saturday Jul 19, 2014 at 00:44 GMT Originally opened as https://github.com/gtorrent/gTorrent-legacy/issues/103
from some guy on IRC, can we test + merge this?
if( downloaded <= 0 ) { ttd << string(); } else { const string suffixes[] = { " B", " KB", " MB", " GB" }; const int maxoffset = sizeof( suffixes ) / sizeof( suffixes[0] ); int offset = floor( log( downloaded ) / log( 1024 ) ); if( offset >= maxoffset ) offset = maxoffset - 1; ttd << fixed << setprecision(3) << downloaded / pow( 1024, offset ) << suffixes[offset]; } return ttd.str();
from some guy on IRC, can we test + merge this?