mirror of
https://github.com/apache/nuttx.git
synced 2026-05-19 03:03:37 +08:00
libc/time: Initialize tm_zone field correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ief32aedc72ec062d428f8538a25ddfe4f81d7e29
This commit is contained in:
committed by
David Sidrane
parent
d72655e74c
commit
e2d827cb6d
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user