[racket] How can I measure time in nanoseconds?

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Nov 12 17:12:48 EST 2010

5 minutes ago, Jakub Piotr Cłapa wrote:
> On 11.11.10 22:08, Horace Dynamite wrote:
> > *slaps forehead*
> >
> > Thank you Eli & Jay. :^)
> >
> > Horace.
> >
> > On 11/11/2010 18:36, Jay McCarthy wrote:
> >> In case it is not clear Horace, because it is inexact, there are
> >> numbers after the decimal, representing nanoseconds, etc.
> 
> And in the case this is still not clear ;) the inexact part is not only 
> about formal inexactnes but about limited timer resolution as well. 
> Despite the CPU clock ticking more than once each nanosecond the 
> procesor and OS does not really count the time this accurately. On 
> normal OSes I would expect microsecond accuracy at best (but that is a 
> guess; I didn't measure).

Easy to do, just run

  (- (current-inexact-milliseconds) (current-inexact-milliseconds))

a few times.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.