HumanDynamics / openbadge

MIT License
49 stars 19 forks source link

Fixed timewarp bug. #23

Closed anguslocke closed 8 years ago

anguslocke commented 8 years ago

In time/counter handling code, main 32768Hz counter was mistakenly cast to an unsigned long, instead of unsigned long long. Resulting overflow caused erroneous millis() values, leading to incorrect evaluations of now().

Note: verified by initiating counter to ~2 minutes before the problem time. Bug occurred after ~2minutes under this condition; the fix prevents the bug from occurring. The fix has not been truly verified with the counter initiated from 0 as normal. (it takes about ~36 hours to encounter the bug in this case). To be 100% safe, this could be verified before merging; but it is unlikely that the minor edits made here would break anything.

OrenLederman commented 8 years ago

Note - this fixes bug #13