From d9e0c6c8592a9e423f29093a71288874ad1ef4ab Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Thu, 19 Sep 2019 19:52:43 +0200 Subject: [PATCH] sys/arduino: use 64bit usec to compute millis() This is quick solution to avoid wrapping around after 4294967 milliseconds. It uses xtimer_now_usec64 instead of xtimer_now_usec. Notice that this is more expansive than the previous solution, especially on AVR systems. --- sys/arduino/base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arduino/base.cpp b/sys/arduino/base.cpp index eccb7b5f1643..8ead5b88cd07 100644 --- a/sys/arduino/base.cpp +++ b/sys/arduino/base.cpp @@ -74,7 +74,7 @@ unsigned long micros() unsigned long millis() { - return xtimer_now_usec() / US_PER_MS; + return xtimer_now_usec64() / US_PER_MS; } int analogRead(int arduino_pin)