Skip to content

Commit 9918083

Browse files
committed
Minor improvement to the sleep-until function.
Source code from moar2018.01.
1 parent 1bf43f4 commit 9918083

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

doc/Type/Date.pod6

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,16 @@ say sleep-timer 0; # OUTPUT: 0
271271
272272
sub sleep-until(Instant $until --> Bool)
273273
274-
Works just like C<sleep> but checks the current time and goes back to sleep
275-
if accidentally woken up early, to guarantee waiting until the specified
276-
time. Returns C<True> if the function actually waited, or if the specified
277-
time happens to be the present moment. Returns C<False> if you asked to
278-
sleep until a time in the past.
274+
Works similar to C<sleep> but checks the current time and keeps sleeping
275+
until the required instant in the future has been reached.
276+
It uses internally the C<sleep-timer> method in a loop to ensure that,
277+
if accidentaly woken up early, it will wait again for the specified
278+
amount of time remaining to reach the specified instant.
279+
goes back to sleep
280+
281+
Returns C<True> if the C<Instant> in the future has been achieved (either
282+
by mean of sleeping or because it is right now), C<False> in the case
283+
an C<Instant> in the past has been specified.
279284
280285
To sleep until 10 seconds into the future, one could write something like this:
281286

0 commit comments

Comments
 (0)