sub sleep
Documentation for sub sleep
assembled from the following types:
class Date
From Date
(Date) sub sleep
sub sleep( = Inf --> Nil)
Attempt to sleep for the given number of $seconds
. Returns Nil
on completion. Accepts Int
, Num
, Rat
, or Duration
types as an argument since all of these also do Real
.
sleep 5; # Intsleep 5.2; # Numsleep (5/2); # Ratsleep (now - now + 5); # Duration
It is thus possible to sleep for a non-integer amount of time. For instance, the following code shows that sleep (5/2)
sleeps for 2.5 seconds and sleep 5.2
sleeps for 5.2 seconds:
my = now;sleep (5/2);my = now;say -; # OUTPUT: «2.502411561»= now;sleep 5.2;= now;say -; # OUTPUT: «5.20156987»