diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index febb71b5..e9c37a89 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -312,7 +312,13 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', $nextTurn = addTurn($prevTurn, $gameStor->turnterm); $maxActionTime = ini_get('max_execution_time'); - $maxActionTime = max($maxActionTime * 2 / 3, $maxActionTime - 10); + if($maxActionTime == 0){ + $maxActionTime = 60; + } + else { + $maxActionTime = max($maxActionTime * 2 / 3, $maxActionTime - 10); + } + $limitActionTime = (new \DateTimeImmutable())->add(TimeUtil::secondsToDateInterval($maxActionTime)); // 현재 턴 이전 월턴까지 모두처리. @@ -326,8 +332,6 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', // 트래픽 업데이트 updateTraffic(); - /* - TODO: executionOver 재설계 if($executionOver){ if($currentTurn !== null){ $gameStor->turntime = $currentTurn; @@ -335,7 +339,6 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', unlock(); return; } - */ // 1달마다 처리하는 것들, 벌점 감소 및 건국,전턴,합병 -1, 군량 소모 diff --git a/src/sammo/TimeUtil.php b/src/sammo/TimeUtil.php index cc0c00a4..f06ecb6c 100644 --- a/src/sammo/TimeUtil.php +++ b/src/sammo/TimeUtil.php @@ -79,13 +79,13 @@ class TimeUtil public static function secondsToDateInterval(float $fullSeconds): \DateInterval{ $d0 = new \DateTime("@0"); - return static::secondsToDateTime($fullSeconds, true)->diff($d0); + return $d0->diff(static::secondsToDateTime($fullSeconds, true)); } public static function DateTimeToSeconds(\DateTimeInterface $dateTime): float{ $d0 = new \DateTimeImmutable("@0"); - return static::DateIntervalToSeconds($dateTime->diff($d0)); + return static::DateIntervalToSeconds($d0->diff($dateTime)); } public static function DateIntervalToSeconds(\DateInterval $interval): float{