Show only three significant digits in check execution time

fixes #8849
This commit is contained in:
Alexander A. Klimov 2015-05-15 17:32:13 +02:00
parent 58434d9743
commit 533c980a29
1 changed files with 12 additions and 1 deletions

View File

@ -68,7 +68,18 @@ if ($object->getType() === $object::TYPE_HOST) {
<?php if ($object->check_execution_time): ?>
<tr>
<th><?= $this->translate('Check execution time') ?></th>
<td><?= $object->check_execution_time ?>s</td>
<td><?php
$matches = array();
if (preg_match(
'/(?<!.)([0-9]+\.[0-9]{4,})(?!.)/ms',
$object->check_execution_time,
$matches
)) {
printf('%.3f', (float) $matches[1]);
} else {
echo $object->check_execution_time;
}
?>s</td>
</tr>
<?php endif ?>
<?php if ($object->check_latency): ?>