Skip to content

Commit

Permalink
extmod/utime_mphal: Fix comment re delta range check in time_ticks_add.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Feb 15, 2023
1 parent e1f211c commit fe330c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion extmod/utime_mphal.c
Expand Up @@ -103,7 +103,7 @@ STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) {
// The latter requires excluding delta=-TICKS_PERIOD/2.
//
// This unsigned comparison is equivalent to a signed comparison of:
// delta <= TICKS_PERIOD/2 || delta >= TICKS_PERIOD/2
// delta <= -TICKS_PERIOD/2 || delta >= TICKS_PERIOD/2
if (delta + MICROPY_PY_UTIME_TICKS_PERIOD / 2 - 1 >= MICROPY_PY_UTIME_TICKS_PERIOD - 1) {
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("ticks interval overflow"));
}
Expand Down

0 comments on commit fe330c7

Please sign in to comment.