Timeline for How to reset millis( )?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 6, 2020 at 17:12 | comment | added | DataFiddler | @ratchet freak, you're right: The calculation is the same, no matter if interpreted unsigned or signed, so any resulting interval < 24.x days will be positive, even if stopmillis and (in the next period) startmillis become negative. But negative timestamps (and signed intervals) are harder to imagine. :) | |
Jan 6, 2020 at 15:10 | comment | added | CrossRoads | It's a 49+ day rollover. unsigned long lets millis() return from 0 to 4,294,967,295 mS. x 1 second/1000mS, x 1 minute/60 seconds, x 1 hour/60 minutes, x 1 day/24 hours = 49.59 days | |
Jan 6, 2020 at 13:10 | comment | added | ratchet freak |
@DataFiddler but doing stopmillis-startmillis will always return the correct value if the time between start and stop is less than the 24-day rollover.
|
|
Jan 6, 2020 at 12:14 | comment | added | DataFiddler | BTW: millis() returns an unsigned long. That will make a difference after 24 days of continuous running. And it will allow running forever, even when that unsigned long will roll over. | |
Jan 6, 2020 at 11:45 | comment | added | Majenko | @Laurentien Please... don't post photographs of code. Post the actual code. | |
Jan 6, 2020 at 11:11 | comment | added | Laurentien | I‘ve just added a picture of my program, maybe you‘re able to take a look | |
Jan 6, 2020 at 11:00 | history | answered | Majenko | CC BY-SA 4.0 |