Skip to content

Commit

Permalink
Avoid setting an alarm in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
peterharperuk committed Sep 25, 2024
1 parent d08f36c commit 76755e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/pico_time/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ static void alarm_pool_irq_handler(void) {
index = next;
}
}
now = (int64_t) ta_time_us_64(timer);
earliest_index = pool->ordered_head;
if (earliest_index < 0) break;
// need to wait
alarm_pool_entry_t *earliest_entry = &pool->entries[earliest_index];
earliest_target = earliest_entry->target;
ta_set_timeout(timer, timer_alarm_num, earliest_target);
now = (int64_t) ta_time_us_64(timer);
// check we haven't now past the target time; if not we don't want to loop again
} while ((earliest_target - now) <= 0);
}
Expand Down

0 comments on commit 76755e1

Please sign in to comment.