mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 10:21:19 +03:00
utilities: Update time/r methods for LINUX
Default to MONOTONIC clock for timer methods to avoid falling victim to clock corrections. Changed signatures from accepting pointers since this is not needed an complicates calls and Java/JS/Python bindings. * Switched from nanosleep to clock_nanosleep to allow developers to provide a clock for LINUX * Default upm_clock_init to CLOCK_MONOTONIC * Updated logic to calculating delay and elapsed to be more readable * Added ns flavors for completeness * Refactored all upm_* delay/timer methods * Added #else for preprocessor cases w/o an #else * Added test for AQI * Added test fixture with logic to identify a minimum delay time which is used as a metric for testing all delay methods * Much more lenient unit testing of delays to minimize false CI failures Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -456,8 +456,7 @@ upm_result_t mcp2515_set_opmode(const mcp2515_context dev,
|
||||
<< _MCP2515_CANSTAT_OPMODE_SHIFT);
|
||||
|
||||
bool done = false;
|
||||
upm_clock_t clock;
|
||||
upm_clock_init(&clock);
|
||||
upm_clock_t clock = upm_clock_init();
|
||||
|
||||
do
|
||||
{
|
||||
@ -623,8 +622,7 @@ upm_result_t mcp2515_transmit_buffer(const mcp2515_context dev,
|
||||
return UPM_SUCCESS;
|
||||
|
||||
// now spin with timeout waiting for it to be transmitted
|
||||
upm_clock_t clock;
|
||||
upm_clock_init(&clock);
|
||||
upm_clock_t clock = upm_clock_init();
|
||||
bool done = false;
|
||||
|
||||
do
|
||||
|
Reference in New Issue
Block a user