First let us ignore the time consumed by executing the code except Thread.sleep().
Second let us ignore the time deviation caused by the kick of the machine's time clock, other processes running, system management, etc.
Then the threshold of the sleeping time of the main thread should be 9999 or less, not less than 1000.
This post has been archived. It cannot be replied.