Skip to content

micros() and millis() are uint32_t (unsigned int), instead of unsigned long #384

Closed
@erenfro

Description

@erenfro

Arduino-esp32/cores/esp32/esp32-hal.h

Shows that millis() and micros() are uint32_t types, which is unsigned int's. This is incompatible with the ESP8266 code which was unsigned long types. This causes portability to go downhill due to type differences.

It causes problems in portability in the SDK itself. How I found it specifically in my case is I have a function that is passed the reference of either millis or micros to use to determine timing mathmatics for frequency calculations. It was expecting the pointer to be an unsigned long because that's what micros and millis are in everything Arduino, except for ESP32's codebase.

It's also timing as well, because those numbers are long for the reasons of longevity. millis has about the time span of about 50 days, while micros has about 70 minutes. They can do that because of the size of an unsigned long, but can't with an unsigned int because the number isn't as large. This may not be the case of the ESP8266 or ESP32 specifically, however the Arduino SDK documents and uses unsigned long as part of the official documentation and implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions