So, we've kind of avoided dealing with the timebase problem. (Well, okay, mostly me.)
Currently we express time in all APIs as "system ticks," where the system tick is set for the application (board+image) to whatever you want .... but in practice is milliseconds. And basically all code assumes it's milliseconds.
There are two problems with this.
- We often need timing more precise than milliseconds, but changing the tick frequency, while easy, would break basically all drivers.
- The
userlib time-related APIs don't actually do what you'd expect.
On that second point -- if you call sleep_for(1), you will (in the absence of higher priority tasks keeping you from being scheduled at all) sleep for somewhere between 0ms and 1ms. In other words, it's really sleep_for_at_most_ms. Often, we actually want at least.
The actual kernel time API is based on absolute deadlines rather than intervals (basically to keep the kernel out of this argument) so I think we could fix this part in userlib.
So, we've kind of avoided dealing with the timebase problem. (Well, okay, mostly me.)
Currently we express time in all APIs as "system ticks," where the system tick is set for the application (board+image) to whatever you want .... but in practice is milliseconds. And basically all code assumes it's milliseconds.
There are two problems with this.
userlibtime-related APIs don't actually do what you'd expect.On that second point -- if you call
sleep_for(1), you will (in the absence of higher priority tasks keeping you from being scheduled at all) sleep for somewhere between 0ms and 1ms. In other words, it's reallysleep_for_at_most_ms. Often, we actually want at least.The actual kernel time API is based on absolute deadlines rather than intervals (basically to keep the kernel out of this argument) so I think we could fix this part in userlib.