diff --git a/LrcParser.Tests/Parser/Lrc/Utils/LrcStartTimeUtilsTest.cs b/LrcParser.Tests/Parser/Lrc/Utils/LrcStartTimeUtilsTest.cs index 8a97058..7706b61 100644 --- a/LrcParser.Tests/Parser/Lrc/Utils/LrcStartTimeUtilsTest.cs +++ b/LrcParser.Tests/Parser/Lrc/Utils/LrcStartTimeUtilsTest.cs @@ -43,6 +43,7 @@ public void TestDecodeWithInvalidLine(string line, int[] expectedStartTimes, str [TestCase("[01:00.00]", 60000)] [TestCase("[10:00.00]", 600000)] [TestCase("[100:00.00]", 6000000)] + [TestCase("[12:34.567]", 754560)] [TestCase("[0:00.00]", 0)] // prevent throw error in some invalid format. [TestCase("[0:0.0]", 0)] // prevent throw error in some invalid format. [TestCase("[1:00.00][1:02.00]", 60000)] // rarely to get this case, so return the first one. diff --git a/LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs b/LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs index 464f71b..1c30c88 100644 --- a/LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs +++ b/LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs @@ -42,6 +42,7 @@ public void TestDecodeWithInvalidFormat(string text, string expectedText, string [TestCase("<01:00.00>", 60000)] [TestCase("<10:00.00>", 600000)] [TestCase("<100:00.00>", 6000000)] + [TestCase("<12:34.567>", 754560)] [TestCase("<0:00.00>", 0)] // prevent throw error in some invalid format. [TestCase("<0:0.0>", 0)] // prevent throw error in some invalid format. [TestCase("<1:00.00><1:02.00>", 60000)] // rarely to get this case, so return the first one. diff --git a/LrcParser/Parser/Lrc/Utils/LrcStartTimeUtils.cs b/LrcParser/Parser/Lrc/Utils/LrcStartTimeUtils.cs index 3039b93..92e199b 100644 --- a/LrcParser/Parser/Lrc/Utils/LrcStartTimeUtils.cs +++ b/LrcParser/Parser/Lrc/Utils/LrcStartTimeUtils.cs @@ -47,6 +47,7 @@ internal static int ConvertTimeTagToMillionSecond(string timeTag) int minutes = int.Parse(match.Groups[1].Value); int seconds = int.Parse(match.Groups[2].Value); int hundredths = int.Parse(match.Groups[3].Value); + hundredths = (hundredths < 100) ? hundredths : (hundredths / 10); return minutes * 60 * 1000 + seconds * 1000 + hundredths * 10; } diff --git a/LrcParser/Parser/Lrc/Utils/LrcTimedTextUtils.cs b/LrcParser/Parser/Lrc/Utils/LrcTimedTextUtils.cs index 1f418ec..dac9e82 100644 --- a/LrcParser/Parser/Lrc/Utils/LrcTimedTextUtils.cs +++ b/LrcParser/Parser/Lrc/Utils/LrcTimedTextUtils.cs @@ -77,6 +77,7 @@ internal static int ConvertTimeTagToMillionSecond(string timeTag) int minutes = int.Parse(match.Groups[1].Value); int seconds = int.Parse(match.Groups[2].Value); int hundredths = int.Parse(match.Groups[3].Value); + hundredths = (hundredths < 100) ? hundredths : (hundredths / 10); return minutes * 60 * 1000 + seconds * 1000 + hundredths * 10; }