summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--sample/time.rb16
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c2dce66819..7d36c09cfd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jan 2 10:13:54 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/time.rb: use Process.times instead of Time.times.
+
Wed Jan 2 09:09:53 2008 Tadayoshi Funaba <tadf@dotrb.org>
* sample/goodfriday.rb: examples for date are enough. retired.
diff --git a/sample/time.rb b/sample/time.rb
index 84fa9e1a8d2..e16912052ee 100644
--- a/sample/time.rb
+++ b/sample/time.rb
@@ -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)