Fix to Windows platform only: timer tick wrap.
The WIN32 API function GetTickCount() returns a DWORD, unsigned, hence can go negative when returned by uPortGetTickTimeMs() as an int32_t, which is not good, leading to functions not returning for a week or two.  It is now wrapped at INT_MAX.
#include "stddef.h" // NULL, size_t etc.
#include "stdint.h" // int32_t etc.
#include "stdbool.h"
+#include "limits.h" // INT_MAX
#include "windows.h"
@@ -145,7 +146,7 @@ void uPortDeinit()
// Get the current tick in milliseconds.
int32_t uPortGetTickTimeMs()
{
- return GetTickCount();
+ return GetTickCount() % INT_MAX;
}
// Get the minimum amount of heap free, ever, in bytes.
