You are here

public function MarkdownBenchmark::getMilliseconds in Markdown 3.0.x

Retrieves the amount of milliseconds from the diff.

Parameters

bool $format: Flag indicating whether to format the result to two decimals.

Return value

string|float The milliseconds.

1 call to MarkdownBenchmark::getMilliseconds()
MarkdownBenchmark::build in src/MarkdownBenchmark.php

File

src/MarkdownBenchmark.php, line 202

Class

MarkdownBenchmark
Class MarkdownBenchmark.

Namespace

Drupal\markdown

Code

public function getMilliseconds($format = TRUE) {
  $ms = 0;
  $ms += $this->diff->m * 2630000000;
  $ms += $this->diff->d * 86400000;
  $ms += $this->diff->h * 3600000;
  $ms += $this->diff->i * 60000;
  $ms += $this->diff->s * 1000;
  $ms += $this->diff->f * 1000;
  return $format ? number_format($ms, 2) : $ms;
}