private static CalcBitsPerSecond ( System.DateTime start, System.DateTime end, long bytes ) : long | ||
start | System.DateTime | /// Start time for calculation. /// |
end | System.DateTime | /// End time for calculation. /// |
bytes | long | /// Bytes in period between start end end. /// |
return | long |
private static long CalcBitsPerSecond(DateTime start, DateTime end, long bytes) {
if (end < start) {
throw new ArgumentException("The end of a transmission must be higher than the start");
}
TimeSpan difference = end - start;
double seconds = difference.TotalMilliseconds / 1000d;
double dbytes = bytes;
return (long)((dbytes * 8) / seconds);
}