Fixed shift duration calculation

Fixes issue #136
main
Robert Oehlmann 10 years ago
parent b221b362dc
commit c4039f72bb

@ -4,7 +4,7 @@
* @param Shift $shift * @param Shift $shift
*/ */
function shift_length($shift) { function shift_length($shift) {
$length = round(($shift['end'] - $shift['start']) / (60 * 60), 0) . ":"; $length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h"; $length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
return $length; return $length;
} }

Loading…
Cancel
Save