[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04187] RE: How-to time short intervals?

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-24 13:47:16 UTC
List: ruby-talk #4187
> I'd like to time some funcs implemented in an extension but they are
> really fast so:
> 
> start = Time.now
> my_ext_function(args)
> elapsed_time = Time.now - start
> 
> will not do (resolution is microsecs?). 

Some help might be at the
http://dev.rubycentral.com/ref/ref_c_time.html#usec

And my ruby-cygwin run this (shamelessly ripped from excellent reference):

  ruby -e "t=Time.now; puts ('%10.6f' % t.to_f); puts t.usec;"

and outputs this:
964445231.186000
186000

> (Platform-specific syscalls not allowed!)

This has to be quite platform specific, AFAIK C standards do not impose
requirements for better resolution than second. So my guess, without look to
sources, is that microseconds are not supported on all platforms (and
relying on them is not good idea anyway).

	- Aleksi

In This Thread

Prev Next