OSDN Git Service

Make the fixinc/Makefile.* files more similar
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / Thread_Sleep.java
1 // Test that Thread.sleep() works.
2 // Origin: Bryce McKinlay <bryce@albatross.co.nz>
3
4 public class Thread_Sleep
5 {
6   public static void main(String args[])
7   {
8     try
9     {
10       long start = System.currentTimeMillis();
11       System.out.println("sleeping");
12       Thread.sleep(1000);
13       long end = System.currentTimeMillis();
14       if ((end - start) > 1100 || (end - start) < 990)
15         System.out.println ("failed");
16       else
17         System.out.println("ok");
18     }
19     catch (InterruptedException x)
20     {
21       System.out.println("error: Thread interrupted.");
22     }
23   }
24 }