Timing issues when using sleep

Hi :wave:

I’m using the template-based code generation to develop a controller that runs at a fixed rate in c++.
I notice that using a sleep to schedule the function call to the controller, the computation time is affected by the rate, that is on the length of the sleep: the longer the sleep time, the longer the execution time (net of sleep time, of course).
This code reproduces the issue.

Thanks for any suggestions.