suve

awful: function: sleep

Declaration

int :sleep ( float $SECS )
int :sleep ( int $MS )
int :sleep

Summary

Makes the interpreter issue a sleep call to the OS, temporarily halting script execution.

  • If the parameter is a float, it's interpreted as amount of seconds to sleep for.
  • If the parameter is an int, it's interpreted as number of milliseconds to sleep for.
  • If no argument is passed, sleep time defaults to one second.

Note that the value passed is minimum sleep time; due to OS scheduling and clock granularity, the actual sleep time may turn out to be longer. Returned value is the amount of milliseconds passed from function start to function end - actual sleep time.

Example

# Sleep for a total of three seconds.
:writeln s"I'm gonna take a short break."
:sleep f1.0
:sleep i1000
:sleep
:writeln s'Okay, three seconds should be enough.'

wikipage modified on 2014/0601/2317