manual changes
This commit is contained in:
@@ -839,12 +839,17 @@ function roundToNearest15($time)
|
||||
|
||||
// Convert everything to seconds for easier calculation
|
||||
$totalSeconds = ($hours * 3600) + ($minutes * 60) + $seconds;
|
||||
|
||||
// Minimum half hour
|
||||
if ($totalSeconds < 1800) {
|
||||
$totalSeconds = 1800;
|
||||
}
|
||||
|
||||
// Calculate the remainder when divided by 900 seconds (15 minutes)
|
||||
$remainder = $totalSeconds % 900;
|
||||
// Calculate the remainder when divided by 1800 seconds (30 minutes)
|
||||
$remainder = $totalSeconds % 1800;
|
||||
|
||||
if ($remainder > 450) { // If remainder is more than 7.5 minutes (450 seconds), round up
|
||||
$totalSeconds += (900 - $remainder);
|
||||
if ($remainder > 900) { // If remainder is more than 15 minutes (900 seconds), round up
|
||||
$totalSeconds += (1800 - $remainder);
|
||||
} else { // Else round down
|
||||
$totalSeconds -= $remainder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user