lib/ServState/network_usage.rb in ServState-0.1.1 vs lib/ServState/network_usage.rb in ServState-0.1.2

- old
+ new

@@ -1,9 +1,9 @@ module ServState class NetworkUsage - BYTES_IN_MB = 1048576 + BYTES_IN_KB = 1024 attr_reader :speeds def update time_diff = Time.new - @old_time @@ -13,11 +13,11 @@ data.each do |interface, values| down = values[0] - @old_traffic[interface][0] up = values[1] - @old_traffic[interface][1] - down_speed = (down / BYTES_IN_MB / time_diff).round(2) - up_speed = (up / BYTES_IN_MB / time_diff).round(2) + down_speed = (down / BYTES_IN_KB / time_diff).round(2) + up_speed = (up / BYTES_IN_KB / time_diff).round(2) @speeds[interface] = [down_speed, up_speed] end @old_traffic = data \ No newline at end of file