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.

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

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 G. II

On Wed, 23 Aug 2006, Ben J. 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.

a = Time.now.to_f

b = Time.now.to_f

p(b - a)

also there’s Time.now.usec

-a