We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ae1dbb commit 9d11dd3Copy full SHA for 9d11dd3
1 file changed
Src/HALAL/Services/Time/Scheduler.cpp
@@ -227,10 +227,8 @@ void Scheduler::schedule_next_interval() {
227
Scheduler::global_timer_enable();
228
uint8_t next_id = Scheduler::front_id(); // sorted_task_ids_[0]
229
Task& next_task = tasks_[next_id];
230
- uint64_t delta = (next_task.next_fire_us > global_tick_us_)
231
- ? (next_task.next_fire_us - global_tick_us_ + 1ULL) : 1ULL; // +1 to ensure we don't miss, means loss in accuracy
232
-
233
- //TODO: Adding 1 accumulates drift over time analyze if acceptable, it can be solved by adding an extra if
+ uint64_t delta = (next_task.next_fire_us > (global_tick_us_ - 1ULL))
+ ? (next_task.next_fire_us - global_tick_us_) : 1ULL;
234
235
if (delta > kMaxIntervalUs) [[unlikely]] {
236
current_interval_us_ = kMaxIntervalUs;
0 commit comments