20 lines
388 B
PHP
20 lines
388 B
PHP
<?php
|
|
|
|
namespace App\Util;
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
class TimeUtil
|
|
{
|
|
public static function calculate_program_time(Carbon $base_time, int $seconds, int $bias = 0): Carbon
|
|
{
|
|
$time = $base_time->copy()->addSeconds($seconds)->addSeconds($bias);
|
|
if ($time->second > 30) {
|
|
$time->addMinute();
|
|
}
|
|
$time->seconds(0);
|
|
return $time;
|
|
}
|
|
}
|