Gotta love Ruby!

Ruby is an awesome, powerful little language.

I needed a ’time’ command for windows to measure the execution time (in seconds) of a command. Should be trivial, but I’m not Windows API savvy. Here’s the full script in Ruby:


t1 = Time.new  
IO.popen(ARGV.join(' ')) { |pipe| puts pipe.gets }  
t2 = Time.new  

puts "Execution time: #{t2 - t1} seconds"  

Simple, direct, and obvious. LOVE IT!