mg_delay_ms() survives mg_millis() restarting on some 32-bit platforms

This commit is contained in:
Sergio R. Caprile committed 2026-10-22 13:49:21 -03:00
1 parent 770a4ff27e
commit 37c98dd893
2 files changed
+6 -4

No files matched your search

+3 -2
View File
@@ -29399,8 +29399,9 @@ uint64_t mg_ntohll(uint64_t net) {
}
void mg_delayms(unsigned int ms) {
uint64_t to = mg_millis() + ms + 1;
while (mg_millis() < to) (void) 0;
uint64_t now, to = mg_millis() + ms + 1;
while ((now = mg_millis()) < to)
if (now + ms + 1 < to) to = now + ms + 1;
}
#if MG_ENABLE_CUSTOM_CALLOC
+3 -2
View File
@@ -261,8 +261,9 @@ uint64_t mg_ntohll(uint64_t net) {
}
void mg_delayms(unsigned int ms) {
uint64_t to = mg_millis() + ms + 1;
while (mg_millis() < to) (void) 0;
uint64_t now, to = mg_millis() + ms + 1;
while ((now = mg_millis()) < to)
if (now + ms + 1 < to) to = now + ms + 1;
}
#if MG_ENABLE_CUSTOM_CALLOC