You are here

function _simplenews_measure_usec in Simplenews 6

Same name and namespace in other branches
  1. 6.2 includes/simplenews.mail.inc \_simplenews_measure_usec()
  2. 7.2 includes/simplenews.mail.inc \_simplenews_measure_usec()
  3. 7 includes/simplenews.mail.inc \_simplenews_measure_usec()

Helper function to measure PHP execution time in microseconds.

Parameters

bool $start TRUE reset the time and start counting.:

Return value

float: elapsed PHP execution time since start.

1 call to _simplenews_measure_usec()
simplenews_mail_spool in ./simplenews.module
Send simplenews newsletters from the spool.

File

./simplenews.module, line 2393
Simplnews node handling, sent email, newsletter block and general hooks

Code

function _simplenews_measure_usec($start = FALSE) {

  // Windows systems don't implement getrusage(). There is no alternative.
  if (!function_exists('getrusage')) {
    return 0;
  }
  static $start_time;
  $usage = getrusage();
  $now = (double) ($dat["ru_stime.tv_sec"] . '.' . $dat["ru_stime.tv_usec"]) + (double) ($usage["ru_utime.tv_sec"] . '.' . $usage["ru_utime.tv_usec"]);
  if ($start) {
    $start_time = $now;
    return 0;
  }
  return $now - $start_time;
}