Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for timestamp format "HH:mm:ss,fff" #373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Tailviewer.Core.Tests/Parsers/TimestampParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,21 @@ public void TestTryParse13()
timestamp.Should().Be(new DateTime(2019, 7, 8, 16, 18, 58, 381));
}

[Test]
public void TestTryParse14()
{
var parser = new TimestampParser();
parser.TryParse("19:50:58,998",
out var dateTime)
.Should()
.BeTrue();

dateTime.Hour.Should().Be(19);
dateTime.Minute.Should().Be(50);
dateTime.Second.Should().Be(58);
dateTime.Millisecond.Should().Be(998);
}

[Test]
public void TestTryParseLongGarbageLine()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Tailviewer.Core/Parsers/TimestampParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public TimestampParser()
// One of the most bizare formats: Time of day is apparently not interesting enough, just as are fractions of a second.
// We do, however, get the seconds (in nano seconds) since the start of the application...
new TimeOfDaySecondsSinceStartParser(),

new DateTimeParser("HH:mm:ss,fff"),
new DateTimeParser("HH:mm:ss.fff"),
new DateTimeParser("HH:mm:ss")
)
Expand Down