Skip to content

Commit 8a36a9e

Browse files
fix(duration): Divide only seconds part by 1000 if ms and not all
1 parent a98b983 commit 8a36a9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/AbstractCache.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,14 @@ private static function parseDurationToSeconds(string $duration): int
621621
if (isset($matches[3])) {
622622
$seconds += ((int)$matches[3]) * 60; // minutes
623623
}
624+
$secondsPart = 0;
624625
if (isset($matches[4])) {
625-
$seconds += ((int)$matches[4]); // seconds
626+
$secondsPart += ((int)$matches[4]); // seconds
626627
}
627628
if ('m' === ($matches[5])) { // units in milliseconds
628-
$seconds *= 0.001;
629+
$secondsPart *= 0.001;
629630
}
631+
$seconds += $secondsPart;
630632
if ('-' === ($matches[1])) { // negative
631633
$seconds *= -1;
632634
}

0 commit comments

Comments
 (0)