bug in sleep_until on host mode for macOS (#502)
This commit is contained in:
parent
dc4342f0f6
commit
5e05469373
@ -65,12 +65,12 @@ void PICO_WEAK_FUNCTION_IMPL_NAME(busy_wait_until)(absolute_time_t target) {
|
|||||||
const int chunk = 1u<<30u;
|
const int chunk = 1u<<30u;
|
||||||
uint64_t target_us = to_us_since_boot(target);
|
uint64_t target_us = to_us_since_boot(target);
|
||||||
uint64_t time_us = time_us_64();
|
uint64_t time_us = time_us_64();
|
||||||
while (target_us - time_us >= chunk) {
|
while ((int64_t)(target_us - time_us) >= chunk) {
|
||||||
busy_wait_us_32(chunk);
|
busy_wait_us_32(chunk);
|
||||||
time_us = time_us_64();
|
time_us = time_us_64();
|
||||||
}
|
}
|
||||||
if (target_us != time_us) {
|
if (target_us > time_us) {
|
||||||
busy_wait_us_32(target_us - chunk);
|
busy_wait_us_32(target_us - time_us);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user