mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-22 00:56:50 +08:00
The original overflow logic used __spm[tm_mon] as the current month's length when normalizing tm_mday. This produced incorrect dates after crossing month boundaries and left zero or negative days unnormalized. Use the difference between adjacent cumulative day offsets with leap-year handling. Normalize overflow in tm_sec, tm_min, tm_hour, tm_mday, and tm_mon to keep the affected broken-down fields normalized. Add regression tests for month boundaries, leap years, large offsets, zero and negative days, negative time fields, combined overflow, and boundary carry cases. Close #11686 Signed-off-by: Hui Su <3164683437@qq.com>
14 lines
272 B
Python
14 lines
272 B
Python
Import('rtconfig')
|
|
from building import *
|
|
|
|
cwd = GetCurrentDir()
|
|
src = []
|
|
CPPPATH = [cwd]
|
|
|
|
if GetDepend(['RT_UTEST_LIBC_TIME']):
|
|
src += ['time_tc.c']
|
|
|
|
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
|
|
|
|
Return('group')
|