Sleep: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,460: | Line 1,460: | ||
</script></syntaxhighlight> |
</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}}== |
=={{header|Jsish}}== |