1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime

a bit faster.  a patch from Alexander Dymo <dymo@ukrpost.ua> in
  [ruby-core:15337].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-02-02 11:09:24 +00:00
parent 887485907e
commit 6445ddf14a
2 changed files with 10 additions and 1 deletions

View file

@ -304,7 +304,10 @@ module Benchmark
# Returns the elapsed real time used to execute the given block.
#
def realtime(&blk) # :yield:
Benchmark::measure(&blk).real
r0 = Time.now
yield
r1 = Time.now
r1.to_f - r0.to_f
end