Skip to content

Commit

Permalink
MavlinkParse: UtcNow update
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Jan 10, 2025
1 parent f52911a commit 8899024
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ExtLibs/Mavlink/MavlinkParse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void ReadWithTimeout(Stream BaseStream, byte[] buffer, int offset,
timeout = 60000;
}

DateTime to = DateTime.Now.AddMilliseconds(timeout);
DateTime to = DateTime.UtcNow.AddMilliseconds(timeout);

int toread = count;
int pos = offset;
Expand All @@ -112,12 +112,12 @@ public static void ReadWithTimeout(Stream BaseStream, byte[] buffer, int offset,

// reset timeout if we get data
if (read > 0)
to = DateTime.Now.AddMilliseconds(timeout);
to = DateTime.UtcNow.AddMilliseconds(timeout);

if (toread == 0)
break;

if (DateTime.Now > to)
if (DateTime.UtcNow > to)
{
throw new TimeoutException("Timeout waiting for data");
}
Expand Down

0 comments on commit 8899024

Please sign in to comment.