Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp with microseconds
microtime(bool $as_float = false): string|float
$this->components->task($description, function () use ($event) {
$this->dispatcher->dispatch(new ScheduledTaskStarting($event));
$start = microtime(true);
try {
$event->run($this->laravel);
$this->dispatcher->dispatch(new ScheduledTaskStarting($event));
$start = microtime(true);
try {
$event->run($this->laravel);
$this->dispatcher->dispatch(new ScheduledTaskFinished(
$event,
round(microtime(true) - $start, 2)
));
$this->eventsRan = true;
$event,
round(microtime(true) - $start, 2)
));
$this->eventsRan = true;
$this->output->write(" $description ", false, $verbosity);
$startTime = microtime(true);
$result = false;
$startTime = microtime(true);
$result = false;
throw $e;
} finally {
$runTime = $task
? (' '.number_format((microtime(true) - $startTime) * 1000, 2).'ms')
: '';
$runTimeWidth = mb_strlen($runTime);
} finally {
$runTime = $task
? (' '.number_format((microtime(true) - $startTime) * 1000, 2).'ms')
: '';
$runTimeWidth = mb_strlen($runTime);
$this->reconnectIfMissingConnection();
$start = microtime(true);
$start = microtime(true);
protected function getElapsedTime($start)
{
return round((microtime(true) - $start) * 1000, 2);
}
{
return round((microtime(true) - $start) * 1000, 2);
}
protected function writeOutput(Job $job, $status)
{
if ($status == 'starting') {
$this->latestStartedAt = microtime(true);
$this->latestStatus = $status;
$formattedStartedAt = Carbon::now()->format('Y-m-d H:i:s');
{
if ($status == 'starting') {
$this->latestStartedAt = microtime(true);
$this->latestStatus = $status;
$formattedStartedAt = Carbon::now()->format('Y-m-d H:i:s');
$this->output->write(" <fg=gray>{$formattedStartedAt}</> {$job->resolveName()}");
}
$runTime = number_format((microtime(true) - $this->latestStartedAt) * 1000, 2).'ms';
$dots = max(terminal()->width() - mb_strlen($job->resolveName()) - mb_strlen($runTime) - 31, 0);
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
}
$runTime = number_format((microtime(true) - $this->latestStartedAt) * 1000, 2).'ms';
$dots = max(terminal()->width() - mb_strlen($job->resolveName()) - mb_strlen($runTime) - 31, 0);
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
public function command($method, array $parameters = [])
{
$start = microtime(true);
$result = $this->client->{$method}(...$parameters);
{
$start = microtime(true);
$result = $this->client->{$method}(...$parameters);
$result = $this->client->{$method}(...$parameters);
$time = round((microtime(true) - $start) * 1000, 2);
if (isset($this->events)) {
$this->event(new CommandExecuted($method, $parameters, $time, $this));
$time = round((microtime(true) - $start) * 1000, 2);
if (isset($this->events)) {
$this->event(new CommandExecuted($method, $parameters, $time, $this));
public function acquire()
{
$results = $this->redis->eval(
$this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks
);
$this->decaysAt = $results[1];
{
$results = $this->redis->eval(
$this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks
);
$this->decaysAt = $results[1];
public function tooManyAttempts()
{
[$this->decaysAt, $this->remaining] = $this->redis->eval(
$this->tooManyAttemptsLuaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks
);
return $this->remaining <= 0;
{
[$this->decaysAt, $this->remaining] = $this->redis->eval(
$this->tooManyAttemptsLuaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks
);
return $this->remaining <= 0;
public function testRetry()
{
$startTime = microtime(true);
$attempts = retry(2, function ($attempts) {
if ($attempts > 1) {
{
$startTime = microtime(true);
$attempts = retry(2, function ($attempts) {
if ($attempts > 1) {
$this->assertEquals(2, $attempts);
$this->assertEqualsWithDelta(0.1, microtime(true) - $startTime, 0.02);
}
public function testRetryWithPassingSleepCallback()
$this->assertEqualsWithDelta(0.1, microtime(true) - $startTime, 0.02);
}
public function testRetryWithPassingSleepCallback()
public function testRetryWithPassingSleepCallback()
{
$startTime = microtime(true);
$attempts = retry(3, function ($attempts) {
if ($attempts > 2) {
{
$startTime = microtime(true);
$attempts = retry(3, function ($attempts) {
if ($attempts > 2) {