Great!  A 15 millisecond to 5 microsecond improvement in time.clock() resolution is fantastic!

 - Bob


-----Original Message-----
From: Charlie Groves <charlie.groves@gmail.com>
To: boblusebob@aim.com
Cc: jython-dev@lists.sourceforge.net
Sent: Sun, 25 Nov 2007 3:03 pm
Subject: Re: [Jython-dev] Jython Clock Resolution

On Nov 24, 2007 1:29 AM,  <boblusebob@aim.com> wrote:
> 1) Java System.nanoTime() needs java 1.5 so you have to check if you are
> going to put it in a release that allows < Java 1.5.

Yep, this is only going in on trunk which is for 1.5+.

> 2) // A suggested solution
>
> private static double __initialclock__ = 0.0;
> public static double clock() {
> if (__initialclock__ == 0.0) {
> // set on first call
> __initialclock__ = System.nanoTime(); // keep __initialclock__ in
> nanoSeconds
> return 0.0; // I would add this return here - it could improve
> accuracy by a few microseconds
> }
> return (System.nanoTime() - __initialclock__) / 1000000000.0; //
> convert the time to seconds here

That's pretty much what I did and it's committed in r3723. It gets a
resolution of 0.005 ms with your script.

Charlie

Check Out the new free AIM(R) Mail -- Unlimited storage and industry-leading spam and email virus protection.