Hello Guest

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

  • 0 Replies
  • 4142 Views
Bug report: bug in org.lwjgl.test.SysTest
« on: July 15, 2005, 08:24:17 »
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.
Code: [Select]

    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)
Code: [Select]

// 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");