You've already forked lubo_comment_query
新款导入节目单,自动匹配时间(需提前导入分P信息)
This commit is contained in:
19
app/Util/TimeUtil.php
Normal file
19
app/Util/TimeUtil.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user