-
-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hello!
We are using an implementation for C# and I would like to draw your attention to the following code:
int Elapsed = Environment.TickCount;
...
Expired = Environment.TickCount - Elapsed > Timeout;
This is because Environment.TickCount returns values from Int32.MinValue to Int32.MaxValue. Therefore, if the system has been running for 24.9 days, the counter will turn negative and the expression Expired = Environment.TickCount-Elapsed > Timeout will return false for the next 24.9 days.
Instead of Environment.TickCount, I would suggest using a static instance of Stopwatch (which is run once) to get uptime milliseconds.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request