could someone help me a little? I'm downloading files and I'm able to get the actual download speed. but I want to change the UNIT from KB/sec to MB/sec if the speed is greater than 1mbps
How do I know if is greater than 1mbps so that I the UNIT will change as well
Here's my current code.
I'm running this in a loop.
for (int i = 0; i < totalCount; i++)
{
string downloadUrl= LB.Items[i].toString();
double currentSize = TotalFileSize; //882672
string UNIT = "KB/s";
DateTime startTime = DateTime.Now;
await ProgressUpdate(downloadUrl, cts.Token); //the actual download
DateTime endTime = DateTime.Now;
double t = Math.Round(currentSize / 1024 / (endTime - startTime).TotalSeconds);
var downloadSpeed = (string.Format("Download Speed: {0}{1}", t, UNIT));
Thank you.