Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[src/core/control.pm] add &sleep
It's the same as in Beijing, modulo $Inf hack.

Also, uncommented sleep.t in spectest.data.
  • Loading branch information
Carl Masak committed Sep 9, 2011
1 parent c8ebd81 commit ac4d97c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/core/control.pm
Expand Up @@ -179,6 +179,17 @@ sub shell($cmd) {
$status;
}

sub sleep($seconds = $Inf) { # fractional seconds also allowed
my $time1 = time;
if $seconds ~~ $Inf {
pir::sleep__vN(1e16) while True;
} else {
pir::sleep__vN($seconds);
}
my $time2 = time;
return $time2 - $time1;
}

sub QX($cmd) {
my Mu $pio := pir::open__Pss(nqp::unbox_s($cmd), 'rp');
fail "Unable to execute '$cmd'" unless $pio;
Expand Down
2 changes: 1 addition & 1 deletion t/spectest.data
Expand Up @@ -468,7 +468,7 @@ S29-any/isa.t
# S29-context/die.t # segmentation fault
S29-context/eval.t
S29-context/exit.t
# S29-context/sleep.t # err: Could not find sub &sleep
S29-context/sleep.t
S29-conversions/hash.t
S29-conversions/ord_and_chr.t #icu
S32-array/bool.t
Expand Down

0 comments on commit ac4d97c

Please sign in to comment.