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 bb6279fe60 libc/lib_localtime:fix deadcode
bb6279fe60 is described below

commit bb6279fe6061ab82f18d8616f22b2f543a451eb9
Author: anjiahao <anjia...@xiaomi.com>
AuthorDate: Fri Apr 1 18:20:39 2022 +0800

    libc/lib_localtime:fix deadcode
    
    isdst always is false
    
    Signed-off-by: anjiahao <anjia...@xiaomi.com>
---
 libs/libc/time/lib_localtime.c | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c
index 66e90c7ab9..b514e86e03 100644
--- a/libs/libc/time/lib_localtime.c
+++ b/libs/libc/time/lib_localtime.c
@@ -1518,9 +1518,7 @@ static int tzparse(FAR const char *name, FAR struct 
state_s *sp,
       else
         {
           int_fast32_t theirstdoffset;
-          int_fast32_t theirdstoffset;
           int_fast32_t theiroffset;
-          int isdst;
           int i;
           int j;
 
@@ -1529,7 +1527,7 @@ static int tzparse(FAR const char *name, FAR struct 
state_s *sp,
               return -1;
             }
 
-          /* Initial values of theirstdoffset and theirdstoffset */
+          /* Initial value of theirstdoffset */
 
           theirstdoffset = 0;
           for (i = 0; i < sp->timecnt; ++i)
@@ -1542,20 +1540,8 @@ static int tzparse(FAR const char *name, FAR struct 
state_s *sp,
                 }
             }
 
-          theirdstoffset = 0;
-          for (i = 0; i < sp->timecnt; ++i)
-            {
-              j = sp->types[i];
-              if (sp->ttis[j].tt_isdst)
-                {
-                  theirdstoffset = -sp->ttis[j].tt_gmtoff;
-                  break;
-                }
-            }
-
           /* Initially we're assumed to be in standard time */
 
-          isdst = FALSE;
           theiroffset = theirstdoffset;
 
           /* Now juggle transition times and types
@@ -1578,29 +1564,13 @@ static int tzparse(FAR const char *name, FAR struct 
state_s *sp,
                    * offset to the transition time;
                    * otherwise, add the standard time
                    * offset to the transition time.
-                   *
-                   * Transitions from DST to DDST
-                   * will effectively disappear since
-                   * POSIX provides for only one DST
-                   * offset.
                    */
 
-                  if (isdst && !sp->ttis[j].tt_ttisstd)
-                    {
-                      sp->ats[i] += dstoffset - theirdstoffset;
-                    }
-                  else
-                    {
-                      sp->ats[i] += stdoffset - theirstdoffset;
-                    }
+                  sp->ats[i] += stdoffset - theirstdoffset;
                 }
 
               theiroffset = -sp->ttis[j].tt_gmtoff;
-              if (sp->ttis[j].tt_isdst)
-                {
-                  theirdstoffset = theiroffset;
-                }
-              else
+              if (!sp->ttis[j].tt_isdst)
                 {
                   theirstdoffset = theiroffset;
                 }

Reply via email to