You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2021/07/02 16:27:37 UTC
[incubator-nuttx] 09/09: libc/time: Initialize tm_zone field
correctly
This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit e2d827cb6d56c054a65618b27e6493fdc86b44b4
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jun 22 00:07:52 2021 +0800
libc/time: Initialize tm_zone field correctly
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
Change-Id: Ief32aedc72ec062d428f8538a25ddfe4f81d7e29
---
libs/libc/time/lib_localtime.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c
index 1bd3eb7..e94b623 100644
--- a/libs/libc/time/lib_localtime.c
+++ b/libs/libc/time/lib_localtime.c
@@ -1807,6 +1807,7 @@ static FAR struct tm *localsub(FAR const time_t *timep,
result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
tmp->tm_isdst = ttisp->tt_isdst;
tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
+ tmp->tm_zone = tzname[tmp->tm_isdst];
return result;
}
@@ -1830,6 +1831,7 @@ static FAR struct tm *gmtsub(FAR const time_t *timep,
tz_semgive(&g_gmt_sem);
+ tmp->tm_zone = GMT;
return timesub(timep, offset, g_gmt_ptr, tmp);
}
@@ -2004,7 +2006,6 @@ static FAR struct tm *timesub(FAR const time_t *timep,
tmp->tm_mday = (int)(idays + 1);
tmp->tm_isdst = 0;
tmp->tm_gmtoff = offset;
- tmp->tm_zone = tzname[0];
return tmp;
}