Sleep()
Sleep()
Type: REGULAR FUNCTION
Purpose: Pauses the execution of this script until a specific time or until the user clicks the SKIP button.
Times used in Sleep() are in system time expressed as seconds since 00:00:00 1/1/70. See the description of the Time() function for useful information about system times.
This function returns control to Windows® so that it may continue to process other windows and applications. If you have experiments running in other windows, they continue to run normally.
A time delay for a known time interval can be implemented in three steps:
- Call Time() to get the current time as an INDEX.
- Add the desired delay in seconds.
- Use this value in a call to Sleep().
This can be done in one line. Suppose we want to delay for 15 seconds:
Sleep( 15 + Time() )
Usage: Result = Sleep(Time)
Time | INDEX | Sleep until this time
(seconds since 1/1/70) |
|
Result | INDEX | The number of seconds remaining when Sleep returned.
Result is zero if Sleep() returned because Time was reached. If the user clicked the Skip button, Result is the number of seconds remaining until Time. |
Comments are closed.