SLEEP

Suspend program execution

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
SLEEP interval

Arguments

interval

The number of seconds for which program execution is to be suspended. (n)

Discussion

The SLEEP statement suspends program execution for a specified amount of time. Interval can be specified as any numeric type (integer, decimal, implied‑decimal, packed, or implied‑packed) and as either a variable or a literal. If interval is an implied value, the runtime will sleep for the specified number of seconds and milliseconds. Note that the processing of the milliseconds is system dependent, and some systems are able to sleep for a finer granularity than others.

After the time specified by interval has elapsed, execution resumes with the statement following the SLEEP statement.

If interval is greater than 65,535, you’ll get an “Arithmetic operand exceeds maximum size” error ($ERR_BIGNUM). If interval is less than or equal to zero, no sleeping occurs.

On UNIX, if system option #12 and the TBUF I/O environment variable is set, the I/O buffer is flushed before the SLEEP statement is executed.

See also

Examples

sleep 5
sleep 3.2
sleep int_var
sleep imp_var
sleep 2.532 ;Length of time slept could be 2, 2.5, 2.53, or 2.532 seconds

Also see WHILE for an example that uses the SLEEP statement.