Add timestamp to messages

This commit is contained in:
Morten Nielsen 2020-07-30 10:51:24 -07:00
parent 8ef85c3283
commit adad914582
2 changed files with 12 additions and 1 deletions

View file

@ -65,6 +65,7 @@ namespace NmeaParser.Messages
{
MessageType = messageType;
MessageParts = messageParts;
Timestamp = System.Diagnostics.Stopwatch.GetTimestamp() * 1000d / System.Diagnostics.Stopwatch.Frequency;
}
static NmeaMessage()
@ -294,5 +295,14 @@ namespace NmeaParser.Messages
}
return TimeSpan.Zero;
}
/// <summary>
/// Gets a relative timestamp in milliseconds indicating the time the message was created.
/// </summary>
/// <remarks>
/// This value is deduced from <c>System.Diagnostics.Stopwatch.GetTimestamp() * 1000d / System.Diagnostics.Stopwatch.Frequency</c>.
/// You can use it to calculate the age of the message in seconds by calculating the difference between the timestamp and the above expression
/// </remarks>
public double Timestamp { get; }
}
}

View file

@ -24,7 +24,8 @@
Added IGeographicLocation interface to easily get any message that supports reporting a location.
Added GnssMonitor for simplifying monitoring location messages and reporting a location.
Added an NTRIP client for getting RTCM correctional messages from an NTRIP Server.
Improved the buffered stream to more accurately emulate baud rates.</PackageReleaseNotes>
Improved the buffered stream to more accurately emulate baud rates.
All messages now have a unique timestamp useful to expire older messages.</PackageReleaseNotes>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>