ruby-changes:3348
From: ko1@a...
Date: 2 Jan 2008 10:15:41 +0900
Subject: [ruby-changes:3348] tadf - Ruby:r14841 (trunk): * sample/time.rb: use Process.times instead of Time.times.
tadf 2008-01-02 10:15:30 +0900 (Wed, 02 Jan 2008) New Revision: 14841 Modified files: trunk/ChangeLog trunk/sample/time.rb Log: * sample/time.rb: use Process.times instead of Time.times. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14841&r2=14840&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/time.rb?r1=14841&r2=14840&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 14840) +++ ChangeLog (revision 14841) @@ -1,3 +1,7 @@ +Wed Jan 2 10:13:54 2008 Tadayoshi Funaba <tadf@d...> + + * sample/time.rb: use Process.times instead of Time.times. + Wed Jan 2 09:09:53 2008 Tadayoshi Funaba <tadf@d...> * sample/goodfriday.rb: examples for date are enough. retired. Index: sample/time.rb =================================================================== --- sample/time.rb (revision 14840) +++ sample/time.rb (revision 14841) @@ -1,8 +1,12 @@ -#! /usr/local/bin/ruby -cmd = ARGV.join(" ") +#! /usr/bin/env ruby + b = Time.now -system(cmd) +system(*ARGV) e = Time.now -ut, st, cut, cst = Time.times.to_a -total = (e - b).to_f -STDERR.printf "%11.1f real %11.1f user %11.1f sys\n", total, cut, cst + +tms = Process.times +real = e - b +user = tms.cutime +sys = tms.cstime + +STDERR.printf("%11.1f real %11.1f user %11.1f sys\n", real, user, sys) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml