Microtime / Milliseconds?

How do I get more precision that seconds in ruby? If I wanted to know 1
millisecond passed how would I do this?

Thanks for your help.

···

--
Posted via http://www.ruby-forum.com/.

How do I get more precision that seconds in ruby? If I wanted to know 1
millisecond passed how would I do this?

>> start = Time.now
=> Tue Aug 22 12:25:24 CDT 2006
>> elapsed = start - Time.now
=> -16.744711

The fractional portion is fractional seconds. Hope that helps.

James Edward Gray II

···

On Aug 22, 2006, at 12:23 PM, Ben Johnson wrote:

a = Time.now.to_f

   b = Time.now.to_f

   p(b - a)

also there's Time.now.usec

-a

···

On Wed, 23 Aug 2006, Ben Johnson wrote:

How do I get more precision that seconds in ruby? If I wanted to know 1
millisecond passed how would I do this?

Thanks for your help.

--
to foster inner awareness, introspection, and reasoning is more efficient than
meditation and prayer.
- h.h. the 14th dali lama