Bug report: bug in org.lwjgl.test.SysTest

Started by rbscholtus, July 15, 2005, 08:24:17

Previous topic - Next topic

rbscholtus

There's a minor bug in the Thread.sleep() test:
The test records the time before and after a call to Thread.sleep(2000) and prints the actual time taken in this method. The actual time is reported incorrectly.
   System.out.println("Actually slept for: " + (time / (float) resolution) + " seconds");

The variable time contains the time after sleep(), not the time difference, hence the incorrect result.

The following fixes the bug (no access to CVS myself)
// add time2
    long time2, time = Sys.getTime();
//...
    time2 = Sys.getTime();
    System.out.println("Current time: " + time2);
    System.out.println("Actually slept for: " + ((time2-time) / (float) resolution) + " seconds");