Overflow in currentTimeMillis and getTimeNowSeconds #3531

This commit is contained in:
rusefillc 2021-11-11 17:54:31 -05:00
parent 46e9269982
commit 80cf7b5ecd
1 changed files with 5 additions and 2 deletions

View File

@ -171,9 +171,12 @@ efitimems_t currentTimeMillis(void) {
return US2MS(getTimeNowUs()); return US2MS(getTimeNowUs());
} }
// todo: this overflows pretty fast! /**
* Integer number of seconds since ECU boot.
* 31,710 years - would not overflow during our life span.
*/
efitimesec_t getTimeNowSeconds(void) { efitimesec_t getTimeNowSeconds(void) {
return currentTimeMillis() / 1000; return getTimeNowUs() / US_PER_SECOND;
} }
static void resetAccel(void) { static void resetAccel(void) {