Skip to content
Browse files

Make sleep() tell how many seconds we wanted to go in the past.

As suggested by pmurias++.  This also makes the error message independent of
the VM, as the original message apparently came from within Parrot itself.
  • Loading branch information...
1 parent a1e237b commit 6404e5245c39e5930baa74b0d5b39a980fe7c979 @lizmat lizmat committed Jul 22, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/control.pm
View
6 src/core/control.pm
@@ -215,7 +215,11 @@ sub sleep($seconds = $Inf) { # fractional seconds also allowed
my $time1 = time;
if $seconds ~~ $Inf {
nqp::sleep(1e16) while True;
- } else {
+ }
+ elsif $seconds < 0 {
+ fail "Cannot go {abs $seconds} seconds back in time";
+ }
+ else {
nqp::sleep($seconds.Num);
}
return time - $time1;

0 comments on commit 6404e52

Please sign in to comment.
Something went wrong with that request. Please try again.