View Single Post
Old 09-12-2005, 07:40 PM   #6 (permalink)
Robaggio
Crazy
 
System.currentTimeMillis() is bugged on Windows systems. At any point it can be inaccurate by 0-20 milliseconds- more if under heavy load or while running on an Athlon 64(this is a seperate bug though) The bug has been documented but not fixed completely. Part of Sun's solution was to include a higher resolution timer in the release of Java 1.5: System.nanoTime()

This is actually a repackage of a debug timer used internally by a few Sun packages, but it works great nonetheless.

If you're still getting erratic results try executing the code using the server VM.

Last edited by Robaggio; 09-12-2005 at 07:47 PM..
Robaggio is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73