Here you can find the source of sleepSeconds(double secs)
Parameter | Description |
---|---|
secs | Number of second to sleep. |
public static long sleepSeconds(double secs)
//package com.java2s; /**/*w w w. j av a 2 s.c om*/ * ? 2003 Cordys R&D B.V. All rights reserved. The computer program(s) is the proprietary information of Cordys R&D B.V. and * provided under the relevant License Agreement containing restrictions on use and disclosure. Use is subject to the License * Agreement. */ public class Main { /** * Sleeps the number of seconds. * * @param secs Number of second to sleep. * @return Number of milliseconds actually slept. */ public static long sleepSeconds(double secs) { long start = System.currentTimeMillis(); try { Thread.sleep((long) (1000 * secs)); } catch (InterruptedException e) { throw new IllegalStateException("Sleep was interrupted.", e); } long end = System.currentTimeMillis(); return end - start; } }