Microsecond accuracy in Java

I am building a device that uses a Parallax PING sensor. I would like to be able to use Java to control the PING because I have a Java 3D environment. I can communicate with the PING but I have not found a way to get the resolution I need (microseconds). nanoTime() has the precision but not the accuracy, at least the way I am implementing it. Any ideas on what I can do?
SpenceManAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VenabiliCommented:
On the question - I am afraid that you cannot do anything about it in Java. And the Javadoc of System.nanoTime() actually says it pretty clearly: "This method provides nanosecond precision, but not necessarily nanosecond accuracy"

And there is no other method that can help you.

Sorry :(
CEHJCommented:
You might try making a native system call if the OS supports it
VenabiliCommented:
Yeah, I was thinking about it

Even if it does support it, I suspect it will take at least a millisecond to get processed via JNI (or whatever is used to call it) so it won't be better than just using the milliseconds we have... Or even if it is not a full millisecond, it will still be off.... that's why I do not think that the accuracy can be achieved...
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

SpenceManAuthor Commented:
I have heard people talk about the library javax.realtime and people using it, but it is no where to be found. Sort of like Big Foot. Any info on that?

For right now I ended up getting a micro controller that I can program in C to communicate with the sensors separately from the java program. It get's the job done.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VenabiliCommented:
PS: You know that it is not supported on most OSs, right?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.