Merge pull request #157 from robofish/shiftDurationFix

Fixed shift duration calculation
This commit is contained in:
msquare 2014-11-04 11:00:54 +01:00
commit 428d5d70cb
1 changed files with 2 additions and 2 deletions

View File

@ -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;
} }