Skip to content

Commit

Permalink
Fixes repejota#129 Adding optional params to number_format so PHP cor…
Browse files Browse the repository at this point in the history
…rectly formats numbers over 999 seconds
  • Loading branch information
ameliabradley committed Nov 19, 2018
1 parent bd089ea commit ad39ca8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Nats/Connection.php
Expand Up @@ -177,7 +177,7 @@ public function setStreamTimeout($seconds)
if ($this->isConnected() === true) {
if (is_numeric($seconds) === true) {
try {
$timeout = number_format($seconds, 3);
$timeout = number_format($seconds, 3, '.', '');
$seconds = floor($timeout);
$microseconds = (($timeout - $seconds) * 1000);
return stream_set_timeout($this->streamSocket, $seconds, $microseconds);
Expand Down Expand Up @@ -250,7 +250,7 @@ function () {
throw Exception::forStreamSocketClientError($errstr, $errno);
}

$timeout = number_format($timeout, 3);
$timeout = number_format($timeout, 3, '.', '');
$seconds = floor($timeout);
$microseconds = (($timeout - $seconds) * 1000);
stream_set_timeout($fp, $seconds, $microseconds);
Expand Down

0 comments on commit ad39ca8

Please sign in to comment.