Update HistoryGraph.php

with several php-settings there might be problems with timestamp output - so it would be better to use number_format for output. otherwise the graph wont show...
This commit is contained in:
rabauss 2017-04-25 00:31:46 +02:00 committed by Timz99
parent ca57189e56
commit 462e489762
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 4 additions and 4 deletions

View File

@ -225,13 +225,13 @@ class HistoryGraph {
foreach($lines as $key => $value) {
// add the value for each of the different lines
if(isset($uptime[$key])) {
$lines[$key][] = '[' . $time . ',' . round((float) $uptime[$key], 4) . ']';
$lines[$key][] = '[' . number_format($time, 0, '', '') . ',' . round((float) $uptime[$key], 4) . ']';
}
}
if($last_date) {
// Was down before.
// Record the first and last date as a string in the down array
$down[] = '[' . $last_date . ',' . $time . ']';
$down[] = '[' . number_format($last_date, 0, '', '') . ',' . number_format($time, 0, '', '') . ']';
// add the number of microseconds of downtime to counter for %
$time_down += ($time - $last_date);
$last_date = 0;
@ -254,7 +254,7 @@ class HistoryGraph {
}
if($last_date) {
// if last_date is still set, the last check was "down" and we are still in down mode
$down[] = '[' . $last_date . ',0]';
$down[] = '[' . number_format($last_date, 0, '', '') . ',0]';
$time_down += (($end_time->getTimestamp() * 1000) - $last_date);
}
@ -266,7 +266,7 @@ class HistoryGraph {
$data['server_lines'] = sizeof($lines_merged) ? '[' . implode(',', $lines_merged) . ']' : '';
$data['server_down'] = sizeof($down) ? '[' . implode(',', $down) . ']' : '';
$data['series'] = sizeof($series) ? '[' . implode(',', $series) . ']' : '';
$data['end_timestamp'] = $end_time->getTimestamp() * 1000;
$data['end_timestamp'] = number_format($end_time->getTimestamp() * 1000, 0, '', '');
return $data;
}