patacongo edited a comment on issue #2751: URL: https://github.com/apache/incubator-nuttx/issues/2751#issuecomment-768321262
What the op is seeing here is not normally timer behavior. It is a consequence of running the setup up the timer consistent in phase the system time and, hence, experience the maximum error every time. If the timer is set up a random phase with respect to the system timer, then removing the +1 would introduce serious, subtle errors. The +1 was added to fix those errors. For example, suppose the system timer has a 10MS period and you request the a 10MS delay like usleep(10*1000) near the system timer period. That would result in no delay and a complete failure of the timing if +1 were not added to delay ticks. That could result in very bad consequences. Waiting a little too long, on the other hander, is never an error. That will happen normally in real time system due to interruptions, prioritization, etc. However, waiting no as long as requested is just an error. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org