Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

System.nanoTime() - what precision ?

807599Dec 26 2006 — edited Jan 25 2007
Hi, I am doing some tests, where it is essential to have finer accuracy than milliseconds.
Different from some posts here, I have better results on windows than on linux!
On linux System.nanoTime() rounds up the values with 1000 ns accuracy (e.g. 1000, 3000, ...). On windows xp it returns more accurate values (e.g. 2345, 6789). What is the reason for that? How is System.nanoTime() implemented and which kernel function does it use? Is there any possibility to make the function more precise for linux?
Does someone have any idea?
cheers

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 22 2007
Added on Dec 26 2006
6 comments
1,246 views