You are here

protected function Mailer::getCurrentExecutionTime in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Mail/Mailer.php \Drupal\simplenews\Mail\Mailer::getCurrentExecutionTime()
  2. 3.x src/Mail/Mailer.php \Drupal\simplenews\Mail\Mailer::getCurrentExecutionTime()

Returns the current execution time.

Return value

float The elapsed PHP execution time since the last start.

See also

self::startTime()

1 call to Mailer::getCurrentExecutionTime()
Mailer::sendSpool in src/Mail/Mailer.php
Send simplenews newsletters from the spool.

File

src/Mail/Mailer.php, line 511

Class

Mailer
Default Mailer.

Namespace

Drupal\simplenews\Mail

Code

protected function getCurrentExecutionTime() {

  // Windows systems don't implement getrusage(). There is no alternative.
  if (!function_exists('getrusage')) {
    return;
  }
  $usage = getrusage();
  $now = (double) ($usage['ru_stime.tv_sec'] . '.' . $usage['ru_stime.tv_usec']) + (double) ($usage['ru_utime.tv_sec'] . '.' . $usage['ru_utime.tv_usec']);
  return $now - $this->startTime;
}