fix: 턴 시간 변경 코드

This commit is contained in:
2021-09-15 19:06:15 +00:00
committed by Gitea
parent 3433810ed0
commit 88237d369d
4 changed files with 21 additions and 7 deletions
+10 -2
View File
@@ -140,9 +140,17 @@ class TimeUtil
public static function secondsToDateInterval(float $fullSeconds): \DateInterval
{
$d0 = new \DateTime("@0");
$inverted = $fullSeconds < 0?1:0;
return $d0->diff(static::secondsToDateTime($fullSeconds, true));
$fullSeconds = abs($fullSeconds);
$seconds = floor($fullSeconds);
$fraction = $fullSeconds - $seconds;
$interval = new \DateInterval("PT{$seconds}S");
$interval->f = $fraction;
$interval->invert = $inverted;
return $interval;
}
public static function DateTimeToSeconds(\DateTimeInterface $dateTime, bool $isUTC = false): float