From a0be0b3ed6c953437bcac23c38515a6a2ec464c1 Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Mon, 26 Jul 2021 21:51:50 +0100 Subject: [PATCH] ESP8266: Fix overflow check condition --- platforms/esp8266/src/esp_libc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/esp8266/src/esp_libc.c b/platforms/esp8266/src/esp_libc.c index 6e0e23d03..c22a06eec 100644 --- a/platforms/esp8266/src/esp_libc.c +++ b/platforms/esp8266/src/esp_libc.c @@ -144,7 +144,7 @@ IRAM int64_t mgos_uptime_micros(void) { * We don't want to disable ints for every call to this function, * hence the trickery. */ - if (((time ^ prev_time) & (1UL << 31)) != 0) { + if (((time ^ prev_time) & (1UL << 31)) != 0 && (time & (1UL << 31)) == 0) { mgos_ints_disable(); if (t[1] == num_overflows) { /* We got here first, update the global overflow counter. */