You are here

protected function Mailer::getCurrentExecutionTime in Simplenews 8.2

Same name and namespace in other branches
  1. 8 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|null 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 512

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 NULL;
  }
  $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;
}