From: "Martin J. Dürst" Date: 2013-07-17T10:17:31+09:00 Subject: [ruby-core:56056] Re: [CommonRuby - Feature #8640] Add Time#elapsed to return nanoseconds since creation Hello Aaron, On 2013/07/17 1:46, Aaron Patterson wrote: > Hi Martin, > > On Tue, Jul 16, 2013 at 03:24:36PM +0900, duerst (Martin D��rst) wrote: >> >> Issue #8640 has been updated by duerst (Martin D��rst). >> >> >> I think this is a good idea. But since >> duration = Time.now - start >> is in seconds, I'd either keep seconds as units, or make the use of nanoseconds explicit, e.g. like this: >> duration = start.elapsed_nanoseconds > > I chose nanoseconds because it can be represented as an integer, On a 32-bit machine, that works up to about 0.5 seconds. (On a 64-bit machine, it's about 73 years.) After that, it will be a Bignum. Regards, Martin. > so we > don't need to allocate Ruby objects (plus all the other benefits > integers buy us). So I'd really like to stick with nanoseconds as the > unit. > > I'll propose both `elapsed` and `elapsed_nanoseconds` to matz. :-) >