You are here

function dba_mysql_report_uptime in Database Administration 7

Return current MySQL uptime from status string.

File

database/mysql.report.inc, line 79
Provides database driver specific report functions.

Code

function dba_mysql_report_uptime($data) {
  $uptime = $data->status->uptime;
  $days = (int) ($uptime / 86400);
  $uptime %= 86400;
  $hours = (int) ($uptime / 3600);
  $uptime %= 3600;
  $minutes = (int) ($uptime / 60);
  $seconds = $uptime % 60;
  $uptime = sprintf('%d days %02d:%02d:%02d', $days, $hours, $minutes, $seconds);
  return $uptime;
}