Documentation for sub sleep assembled from the following pages:
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; # Int sleep 5.2; # Num sleep (5/2); # Rat sleep (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»