Skip to content

Commit bb81383

Browse files
committed
Move StreamSelectLoop::streamSelect micro- and nanoseconds calculation into the "if"s.
1 parent 3c8a5d6 commit bb81383

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/StreamSelectLoop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,16 @@ private static function getNanoseconds($time)
281281
protected function streamSelect(array &$read, array &$write, $timeout)
282282
{
283283
$seconds = $timeout === null ? null : self::getSeconds($timeout);
284-
$microseconds = $timeout === null ? 0 : self::getMicroseconds($timeout);
285-
$nanoseconds = $timeout === null ? 0 : self::getNanoseconds($timeout);
286284

287285
if ($read || $write) {
288286
$except = [];
287+
$microseconds = $timeout === null ? 0 : self::getMicroseconds($timeout);
289288

290289
return $this->doSelectStream($read, $write, $except, $seconds, $microseconds);
291290
}
292291

293292
if ($timeout !== null) {
293+
$nanoseconds = self::getNanoseconds($timeout);
294294
$this->sleep($seconds, $nanoseconds);
295295
}
296296

0 commit comments

Comments
 (0)