Skip to content

Commit f5db5e0

Browse files
authored
Merge pull request #530 from fjtrujy/time_accuracy
Improve timer accuracy
2 parents 021babe + 611593b commit f5db5e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ee/kernel/src/timer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void SetNextComp(u64 time_now)
284284
while (timer_current != NULL)
285285
{
286286
a1 = timer_current->timer_schedule + timer_current->timer_base_time - timer_current->timer_base_count;
287-
if (a1 < (a0 + 0x7333))
287+
if (a1 < (a0 + 0x733))
288288
{
289289
a0 = a1;
290290
}
@@ -294,9 +294,9 @@ void SetNextComp(u64 time_now)
294294
}
295295
timer_current = timer_current->timer_next;
296296
}
297-
if ((s64)(a0 - time_now) < (s64)0x7333)
297+
if (a0 < (time_now + 0x733))
298298
{
299-
SetT2_COMP((*T2_COUNT) + (0x7333 >> (((*T2_MODE) & 3) << 2)));
299+
SetT2_COMP((*T2_COUNT) + (0x733 >> (((*T2_MODE) & 3) << 2)));
300300
SetT2_MODE((*T2_MODE) & (~(1 << 11)));
301301
}
302302
else

0 commit comments

Comments
 (0)