You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/12 09:10:18 UTC

[incubator-nuttx] branch master updated: lib_localtime:fix unsigned compare with zero

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 49cd445114 lib_localtime:fix unsigned compare with zero
49cd445114 is described below

commit 49cd4451149483cd187bb9d8f9997d0932cbb3ed
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Fri Apr 8 16:13:47 2022 +0800

    lib_localtime:fix unsigned compare with zero
    
    Signed-off-by: anjiahao <an...@xiaomi.com>
---
 libs/libc/time/lib_localtime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c
index b514e86e03..11c08afa1b 100644
--- a/libs/libc/time/lib_localtime.c
+++ b/libs/libc/time/lib_localtime.c
@@ -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;