سؤال

After looking at timer showed on the LWJGL wiki milliseconds weren't fast enough. It kept an inconsistent speed of the player. I can't find anything on how to produce a more accurate timer, like 3.2 milliseconds instead of 3 milliseconds. I know this sounds stupid, but I'm really stuck.

هل كانت مفيدة؟

المحلول

You could use System.nanoTime():

long startTime = System.nanoTime();    
//Stuff in-between
long timeTaken = System.nanoTime() - startTime;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top