sleep - sleep for a while


<sleep $seconds [wake]>

The sleep function pauses (sleeps) for $seconds seconds (for each value of $seconds).

sleep returns the number of seconds remaining to be slept (a float), which is normally 0. However, if the "wake" argument is given, sleep may wake up early and return a non-zero value, if a signal was caught. (This can be used to wait for another process to signal the script and wake it up, or to awaken ASAP/early on <watchpath> callbacks.)

The sleep function was added Sep. 17 1996. The wake flag was added Sep. 1 2000; previous versions behaved as if it were always set.

Sleep durations with fractions of a second may be given, e.g. 1.5. However, the actual sleep duration may vary depending on the platform's clock resolution.

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.