CmisSync.Lib.Streams.BandwidthNotifyingStream.CalcBitsPerSecond C# (CSharp) 메소드

CalcBitsPerSecond() 개인적인 정적인 메소드

Calculates the bits per second.
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. ///
리턴 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);
        }