Sleep: Difference between revisions

No edit summary
Line 1,460:
 
</script></syntaxhighlight>
 
=={{header|jq}}==
 
`sleep($n)` will pause (busily) for at least the given time period, measured in seconds.
The excess time slept, namely `$n | sleep(.) - .`, will likely be less than some particular value on each platform, e.g. 0.00001 seconds on a 3GHz machine.
<syntaxhighlight lang="jq">
# Pseudosleep for at least the given number of $seconds (a number)
# and emit the actual number of seconds that have elapsed.
def sleep($seconds):
now
| . as $now
| until( . - $now >= $seconds; now)
| . - $now ;
</syntaxhighlight>
 
=={{header|Jsish}}==
2,442

edits