Skip to content

Commit

Permalink
sys/arduino: use 64bit usec to compute millis()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
keestux committed Sep 19, 2019
1 parent 66f1cc7 commit d9e0c6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/arduino/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d9e0c6c

Please sign in to comment.