TimeUtil 버그 수정

This commit is contained in:
2019-04-21 03:31:23 +09:00
parent b5d66dba8a
commit 3beca8bba5
2 changed files with 9 additions and 6 deletions
+7 -4
View File
@@ -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, 군량 소모
+2 -2
View File
@@ -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{