Returns hours, minutes and seconds as array.
public static hourminsec ( integer $sek ) : array | ||
$sek | integer | number of seconds to extract the time from |
Résultat | array |
/** * returns time of currently running activity recording as array * * result is meant as params for the stopwatch if the window is reloaded * * <pre> * returns: * [all] start time of entry in unix seconds (forgot why I named it this way, sorry ...) * [hour] * [min] * [sec] * </pre> * * @return array * @author th */ public function get_current_timer() { $user = MySQL::SQLValue($this->kga['user']['userID'], MySQL::SQLVALUE_NUMBER); $p = $this->kga['server_prefix']; $this->conn->Query("SELECT timeEntryID, start FROM {$p}timeSheet WHERE userID = {$user} AND end = 0;"); if ($this->conn->RowCount() == 0) { $current_timer['all'] = 0; $current_timer['hour'] = 0; $current_timer['min'] = 0; $current_timer['sec'] = 0; } else { $row = $this->conn->RowArray(0, MYSQLI_ASSOC); $start = (int) $row['start']; $aktuelleMessung = Kimai_Format::hourminsec(time() - $start); $current_timer['all'] = $start; $current_timer['hour'] = $aktuelleMessung['h']; $current_timer['min'] = $aktuelleMessung['i']; $current_timer['sec'] = $aktuelleMessung['s']; } return $current_timer; }