interval = 1.0 10.times do |x| t1 = Time.new sleep(interval) actual = Time.new - t1 difference = (actual-interval).abs percent_difference = difference / interval * 100 printf("%.9f %.6f %.6f (%.2f%%)\n",interval, actual, difference, percent_difference) interval /= 10 end