Skip to content

Commit 907316d

Browse files
author
Ernst Swanepoel
committed
Adding a timestamp
Updating submodules for Q2.3.0
1 parent 25fa63f commit 907316d

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

QClientAdvancedStreamData/Program.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,30 @@
231231
analogDataPacketCounter += analogDataPackets.Count;
232232
canFdDataPacketCounter += canFdDataPackets.Count;
233233
tachoDataPacketCounter += tachoDataPackets.Count;
234-
analogDataPackets.Clear();
235-
canFdDataPackets.Clear();
236-
tachoDataPackets.Clear();
237234

238235
// Now that the entire payload has been read, print the data to the screen and start all over.
239236
if (timer.ElapsedMilliseconds > lastUpdate + 250)
240237
{
241238
lastUpdate = timer.ElapsedMilliseconds;
239+
var timeStampDateTime = DateTime.MinValue;
240+
241+
if (analogDataPackets.Count > 0)
242+
{
243+
var timeStampEpoch = analogDataPackets.First().GenericChannelHeader.Timestamp;
244+
timeStampDateTime = DateTimeOffset.FromUnixTimeMilliseconds((long)(timeStampEpoch / 1000000))
245+
.DateTime;
246+
}
242247

243248
Console.SetCursorPosition(0, Console.CursorTop - 4);
244-
Console.WriteLine($"Runtime: {timer.Elapsed:hh':'mm':'ss} - Packets received: {packetsReceived}");
249+
Console.WriteLine($"Runtime: {timer.Elapsed:hh':'mm':'ss} - Packets received: {packetsReceived} - Timestamp: {timeStampDateTime}");
245250
Console.WriteLine($"Analog Channel Payloads: {analogDataPacketCounter}");
246251
Console.WriteLine($"CAN FD Channel Payloads: {canFdDataPacketCounter}");
247252
Console.WriteLine($"Tacho Channel Payloads: {tachoDataPacketCounter}");
248253
}
254+
255+
analogDataPackets.Clear();
256+
canFdDataPackets.Clear();
257+
tachoDataPackets.Clear();
249258
}
250259

251260
// Once you are done reading the data from the port remember to close it.

QClientCSharp

0 commit comments

Comments
 (0)