File: SleepTest.java

package info (click to toggle)
libtritonus-java 20070428-9
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,948 kB
  • sloc: ansic: 53,816; java: 45,226; sh: 3,022; makefile: 1,188; xml: 820; cpp: 147
file content (17 lines) | stat: -rw-r--r-- 417 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


public class SleepTest
{
	public static void main(String[] args)
		throws InterruptedException
	{
		long	lRequestedSleepDuration = Long.parseLong(args[0]);
		for (int i = 0; i < 100; i++)
		{
			long	lTimeBefore = System.currentTimeMillis();
			Thread.sleep(lRequestedSleepDuration, 0);
			long	lTimeAfter = System.currentTimeMillis();
			System.out.println("actual sleep: " + (lTimeAfter - lTimeBefore));
		}
	}
}