Why do people use these classes when they could do the following in their display loop:
int fps = 50;
long timeperframe = 1000000000/fps;
time = System.nanoTime();
DO STUFF
time = System.nanoTime() - time;
//time is currently the elapsed time used
time -= timeperframe;
//time is now the extra time that is not used
if(time<0) {time = 0;}
try { Thread.sleep(time) }
catch (Exception e) { //do something sensible
}
Is this a bad method? If so why? I know before java 1.5 was available there wasn’t access to the most accurate available system timer, but now there is whats wrong with using it?