lib_localtime:fix unsigned compare with zero

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2022-04-08 16:13:47 +08:00 committed by Xiang Xiao
parent a56199c7dd
commit 49cd445114

View File

@ -1872,7 +1872,7 @@ static FAR struct tm *timesub(FAR const time_t *timep,
y = EPOCH_YEAR;
tdays = *timep / SECSPERDAY;
rem = *timep - tdays * SECSPERDAY;
while (tdays < 0 || tdays >= g_year_lengths[isleap(y)])
while (tdays >= g_year_lengths[isleap(y)])
{
int newy;
time_t tdelta;