fixed timestamp at the statistics table

This commit is contained in:
2022-06-12 22:40:38 +02:00
parent 4118f76f92
commit 491a12276d
2 changed files with 38 additions and 3 deletions

View File

@@ -106,7 +106,12 @@ function load_station_table($con, $s_id) {
echo "<td>" . $row['Name'] . "</td>\n";
echo "<td>" . $row['Feuerwehr'] . "</td>\n";
echo "<td>" . $row['Punkte'] . "</td>\n";
echo "<td>" . $row["Zeit"] . "</td>\n";
if ($row['Zeit'] != NULL) {
$time = get_time_str($con, $row['m_id'], $s_id);
echo "<td>" . $time . "</td>\n";
} else {
echo "<td>" . $row['Zeit'] . "</td>\n";
}
echo "</tr>\n";
}
echo "</tbody>\n";
@@ -158,4 +163,30 @@ function check_time($con, $m_id, $s_id) {
} else {
return true;
}
}
function get_time_str($con, $m_id, $s_id) {
$minutes = get_minutes($con, $m_id, $s_id)->fetch()['minutes'];
$seconds = get_seconds($con, $m_id, $s_id)->fetch()['seconds'];
$millis = get_millis($con, $m_id, $s_id)->fetch()['millis'];
if ($minutes < 10) {
$time = "0" . $minutes;
} else {
$time = $minutes;
}
if ($seconds < 10) {
$time .= ":0" . $seconds;
} else {
$time .= ":" . $seconds;
}
$millis /= 10000;
if ($millis < 10) {
$time .= ".0" . $millis;
} else {
$time .= "." . $millis;
}
return $time;
}