sub sleep-timer
1 | class Date |
1.1 | (Date) sub sleep-timer |
Documentation for sub sleep-timer
assembled from the following types:
class Date
From Date
(Date) sub sleep-timer
sub sleep-timer(Real() = Inf --> Duration)
This function is implemented like sleep
, but unlike the former it does return a Duration instance with the number of seconds the system did not sleep.
In particular, the returned Duration
will handle the number of seconds remaining when the process has been awakened by some external event (e.g., Virtual Machine or Operating System events). Under normal condition, when sleep is not interrupted, the returned Duration
has a value of 0
, meaning no extra seconds remained to sleep. Therefore, in normal situations:
say sleep-timer 3.14; # OUTPUT: «0»
The same result applies to edge cases, when a negative or zero time to sleep is passed as argument:
say sleep-timer -2; # OUTPUT: 0say sleep-timer 0; # OUTPUT: 0
See also sleep-until.