Skip to content

Commit 609ac29

Browse files
yndu13peze
authored andcommitted
fix sleep method in builtin
1 parent cd33d47 commit 609ac29

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/builtin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,10 @@ class Func {
394394
}
395395

396396
sleep(args) {
397-
this.generator.emit('usleep');
398-
this.generator.visitArgs(args);
397+
this.generator.emit('usleep(');
398+
const expr = args[0];
399+
this.generator.visitExpr(expr);
400+
this.generator.emit(' * 1000)');
399401
}
400402

401403
equal(args){

tests/expected/builtin/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static public function main($args)
420420

421421
}
422422

423-
usleep($a);
423+
usleep($a * 1000);
424424
$defaultVal = ''.(@$args[0] ? @$args[0] : @$args[1]);
425425
if ($defaultVal === $b) {
426426
return null;

0 commit comments

Comments
 (0)