From 0172e97151355ea43abb5762631d8bd0edcceaef Mon Sep 17 00:00:00 2001 From: Junzhuo <57790433+zao111222333@users.noreply.github.com> Date: Wed, 4 May 2022 00:43:27 +0800 Subject: [PATCH] utils.py: fix assert range with hour `hour=23` (23 P.M.) will out of the `range(0, 23)`, which should be `range(0, 24)`. --- components/fatfs/fatfsgen_utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/fatfs/fatfsgen_utils/utils.py b/components/fatfs/fatfsgen_utils/utils.py index 16867d4680..a12002a2d5 100644 --- a/components/fatfs/fatfsgen_utils/utils.py +++ b/components/fatfs/fatfsgen_utils/utils.py @@ -226,7 +226,7 @@ def build_time_entry(hour: int, minute: int, sec: int) -> int: :returns: 16 bit integer number (5 bits for hour, 6 bits for minute and 5 bits for second) """ - assert hour in range(0, 23) + assert hour in range(0, 24) assert minute in range(0, 60) assert sec in range(0, 60) return int.from_bytes(TIME_ENTRY.build(dict(hour=hour, minute=minute, second=sec // 2)), 'big')