Micros() rolling over after 59.652323 seconds, not 71 minutes [SOLVED]

Yay! I'm glad to see you digging into this :slight_smile: @rvnash

If you read again I am saying if you want precise timing for something that's almost a minute long (>59.652323s micros() rollover), that you should use the millis() counter. If you need such dynamic range, <1ms ~ >59652ms you could check the micros() counter first and if you get to be over (10246464)us aka 0b10000000000000000000000 (a quick bit mask check), you could switch to testing against the millis() counter. If your very short even is happening asynchronously, then you need to use interrupts. Read on :smile:

Agreed this makes the result not super accurate, but you can roll your own precision counter pretty easily using interrupts and the DWT counter Stopwatch for Pinewood Derby - #17 by BDub

SYSTEM_US_TICKS is the number of ticks per microsecond, calculated as SystemCoreClock / 1000000. So it is calculated based on each system's core clock speed (72MHz vs 120MHz). You're right we should document this rollover number for both systems (the Core is done, Photon would need to be calculated). If you are doing the math and would like to submit a pull request to update the comments of that code, please do! Even if you just submit the information as a firmware/docs issue that would be sweet.

It would also be good to document this anomaly, which could be solved by rolling your own DWT/Interrupt timer, or Peekay's proposed timer capture mode.