ruby-changes:3349
From: ko1@a...
Date: 2 Jan 2008 10:19:51 +0900
Subject: [ruby-changes:3349] tadf - Ruby:r14842 (ruby_1_8): * sample/time.rb: use Process.times instead of Time.times.
tadf 2008-01-02 10:19:41 +0900 (Wed, 02 Jan 2008) New Revision: 14842 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/sample/time.rb Log: * sample/time.rb: use Process.times instead of Time.times. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=14842&r2=14841&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/sample/time.rb?r1=14842&r2=14841&diff_format=u Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 14841) +++ ruby_1_8/ChangeLog (revision 14842) @@ -1,3 +1,7 @@ +Wed Jan 2 10:18:56 2008 Tadayoshi Funaba <tadf@d...> + + * sample/time.rb: use Process.times instead of Time.times. + Wed Jan 2 09:18:11 2008 Tadayoshi Funaba <tadf@d...> * sample/goodfriday.rb: examples for date are enough. retired. Index: ruby_1_8/sample/time.rb =================================================================== --- ruby_1_8/sample/time.rb (revision 14841) +++ ruby_1_8/sample/time.rb (revision 14842) @@ -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