1.9 Missing method? Time#times

Discussion in 'Ruby' started by jzakiya, Dec 25, 2007.

  1. jzakiya

    jzakiya Guest

    I was running the files in the 1.9.0 /samples directory and incurred a
    "`<main>': undefined method `times' for Time:Class (NoMethodError)"

    time.rb

    #! /usr/local/bin/ruby
    cmd = ARGV.join(" ")
    b = Time.now
    system(cmd)
    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

    I did a Time.methods, and sure enough it's there in 1.8.6 but not
    1.9.0.

    Is this an oversight, or is this now deliberately deprecated behavior?
    How would you do the equivalent in 1.9.0 if deprecated?
    jzakiya, Dec 25, 2007
    #1
    1. Advertising

  2. Re: 1.9 Missing method? Time#times

    On Dec 26, 2007 8:44 AM, jzakiya <> wrote:
    > I was running the files in the 1.9.0 /samples directory and incurred a
    > "`<main>': undefined method `times' for Time:Class (NoMethodError)"
    >
    > time.rb
    >
    > #! /usr/local/bin/ruby
    > cmd = ARGV.join(" ")
    > b = Time.now
    > system(cmd)
    > 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
    >
    > I did a Time.methods, and sure enough it's there in 1.8.6 but not
    > 1.9.0.
    >
    > Is this an oversight, or is this now deliberately deprecated behavior?
    > How would you do the equivalent in 1.9.0 if deprecated?


    manveru@sigma ~ % irb
    Time.times
    (irb):1: warning: obsolete method Time::times; use Process::times
    # #<struct Struct::Tms utime=0.08, stime=0.02, cutime=0.0, cstime=0.0>
    Michael Fellinger, Dec 26, 2007
    #2
    1. Advertising

  3. jzakiya

    jzakiya Guest

    Re: 1.9 Missing method? Time#times

    On Dec 25, 7:14 pm, Michael Fellinger <> wrote:
    > On Dec 26, 2007 8:44 AM, jzakiya <> wrote:
    >
    >
    >
    > > I was running the files in the 1.9.0 /samples directory and incurred a
    > > "`<main>': undefined method `times' for Time:Class (NoMethodError)"

    >
    > > time.rb

    >
    > > #! /usr/local/bin/ruby
    > > cmd = ARGV.join(" ")
    > > b = Time.now
    > > system(cmd)
    > > 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

    >
    > > I did a Time.methods, and sure enough it's there in 1.8.6 but not
    > > 1.9.0.

    >
    > > Is this an oversight, or is this now deliberately deprecated behavior?
    > > How would you do the equivalent in 1.9.0 if deprecated?

    >
    > manveru@sigma ~ % irb
    > Time.times
    > (irb):1: warning: obsolete method Time::times; use Process::times
    > # #<struct Struct::Tms utime=0.08, stime=0.02, cutime=0.0, cstime=0.0>


    Yes

    Replacing Process.times for Time.times in the file time.rb
    for 1.9 performs the same as in 1.8.6.

    Thanks
    jzakiya, Dec 26, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWF2cmlja18xMDE=?=

    SetAuthCookie works some times and fails some times?

    =?Utf-8?B?bWF2cmlja18xMDE=?=, Mar 23, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    510
    =?Utf-8?B?bWF2cmlja18xMDE=?=
    Mar 23, 2006
  2. =?Utf-8?B?bWF2cmlja18xMDE=?=

    Forms Authentication Fails some times and not some times???

    =?Utf-8?B?bWF2cmlja18xMDE=?=, Mar 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    487
    =?Utf-8?B?bWF2cmlja18xMDE=?=
    Mar 28, 2006
  3. djskrill
    Replies:
    9
    Views:
    695
    djskrill
    Oct 1, 2003
  4. Peng Yu
    Replies:
    17
    Views:
    687
    Peng Yu
    Sep 14, 2008
  5. Jack Steven
    Replies:
    2
    Views:
    429
    Chris Rebert
    Mar 9, 2009
Loading...

Share This Page